Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Add or update OpenTelemetry and Azure Application Insights settings in an existing Data API builder configuration file. If the runtime.telemetry section doesn't exist, it gets created. Unspecified options leave existing values unchanged.
Note
Telemetry settings aren't configurable with dab configure. Use dab add-telemetry for all runtime.telemetry changes.
For conceptual guidance and end-to-end walkthroughs, see Use OpenTelemetry and activity traces and Use Azure Application Insights.
Syntax
dab add-telemetry [options]
Quick glance
| Option | Summary |
|---|---|
-c, --config |
Config file path. Default dab-config.json. |
OpenTelemetry section
| Option | Summary |
|---|---|
--otel-enabled |
Enable or disable OpenTelemetry. |
--otel-endpoint |
OpenTelemetry collector endpoint URL. |
--otel-protocol |
Export protocol. Allowed values: grpc, httpprotobuf. |
--otel-service-name |
Service name tag on all telemetry. |
--otel-headers |
Extra headers to send to the OpenTelemetry collector. |
Azure Application Insights section
| Option | Summary |
|---|---|
--app-insights-enabled |
Enable or disable Azure Application Insights. |
--app-insights-conn-string |
Application Insights connection string. |
-c, --config
Path to the configuration file. Defaults to dab-config.json unless dab-config.<DAB_ENVIRONMENT>.json exists, where DAB_ENVIRONMENT is an environment variable.
Example
dab add-telemetry \
--config ./my-config.json \
--otel-enabled true
--otel-enabled
Enable or disable the OpenTelemetry exporter. Accepted values: true, false.
Example
dab add-telemetry \
--otel-enabled true
Resulting config
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true
}
}
}
}
--otel-endpoint
URL of your OpenTelemetry collector or back end. For gRPC, use http://<host>:<port>. For HTTP, include the full path, for example http://<host>:<port>/v1/traces.
Example
dab add-telemetry \
--otel-enabled true \
--otel-endpoint "http://localhost:4317"
Resulting config
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "http://localhost:4317"
}
}
}
}
--otel-protocol
Export protocol for the OpenTelemetry exporter. Allowed values: grpc, httpprotobuf. Defaults to grpc.
Example
dab add-telemetry \
--otel-enabled true \
--otel-endpoint "http://localhost:4318" \
--otel-protocol "httpprotobuf"
Resulting config
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "http://localhost:4318",
"exporter-protocol": "httpprotobuf"
}
}
}
}
--otel-service-name
Service name tag attached to all traces and metrics. Appears as the service identifier in your telemetry back end. Defaults to dab.
Example
dab add-telemetry \
--otel-enabled true \
--otel-service-name "my-dab-api"
Resulting config
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"service-name": "my-dab-api"
}
}
}
}
--otel-headers
Extra HTTP headers to include when exporting telemetry to the collector. Use a comma-separated key=value list. Use this option for authenticated collector endpoints that require an API key or authorization header.
Example
dab add-telemetry \
--otel-enabled true \
--otel-endpoint "https://collector.example.com:4317" \
--otel-headers "api-key=my-secret-key"
--app-insights-enabled
Enable or disable Azure Application Insights telemetry. Accepted values: true, false.
Example
dab add-telemetry \
--app-insights-enabled true
Resulting config
{
"runtime": {
"telemetry": {
"application-insights": {
"enabled": true
}
}
}
}
--app-insights-conn-string
Connection string for your Azure Application Insights resource. Use an environment variable reference to avoid committing secrets to source control.
Warning
Never hard-code the connection string directly in your configuration file. Use @env('<variable-name>') or a secret manager.
Example
dab add-telemetry \
--app-insights-enabled true \
--app-insights-conn-string "@env('APP_INSIGHTS_CONN_STRING')"
Resulting config
{
"runtime": {
"telemetry": {
"application-insights": {
"enabled": true,
"connection-string": "@env('APP_INSIGHTS_CONN_STRING')"
}
}
}
}
Full example: OpenTelemetry and Application Insights
The following example enables both OpenTelemetry and Application Insights in a single command.
dab add-telemetry \
--otel-enabled true \
--otel-endpoint "http://localhost:4317" \
--otel-protocol "grpc" \
--otel-service-name "my-dab-api" \
--app-insights-enabled true \
--app-insights-conn-string "@env('APP_INSIGHTS_CONN_STRING')"
Resulting config
{
"runtime": {
"telemetry": {
"open-telemetry": {
"enabled": true,
"endpoint": "http://localhost:4317",
"service-name": "my-dab-api",
"exporter-protocol": "grpc"
},
"application-insights": {
"enabled": true,
"connection-string": "@env('APP_INSIGHTS_CONN_STRING')"
}
}
}
}