You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`connection_string`| The [connection string][connection_string_doc] for your Application Insights resource. The connection string will be automatically populated from the `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable if not explicitly passed in. |`APPLICATIONINSIGHTS_CONNECTION_STRING`|
58
-
|`exclude_instrumentations`| By default, all supported [instrumentations](#officially-supported-instrumentations) are enabled to collect telemetry. Specify instrumentations you do not want to enable to collect telemetry by passing in a comma separated list of instrumented library names. e.g. `["requests", "flask"]`||
59
-
|`resource`| Specifies the OpenTelemetry [resource][opentelemetry_spec_resource] associated with your application. See [this][ot_sdk_python_resource] for default behavior. |[OTEL_SERVICE_NAME][opentelemetry_spec_service_name], [OTEL_RESOURCE_ATTRIBUTES][opentelemetry_spec_resource_attributes]|
60
-
|`disable_logging`| If set to `True`, disables collection and export of logging telemetry. Defaults to `False`. ||
61
-
|`disable_metrics`| If set to `True`, disables collection and export of metric telemetry. Defaults to `False`. ||
62
-
|`disable_tracing`| If set to `True`, disables collection and export of distributed tracing telemetry. Defaults to `False`. ||
63
-
|`logging_level`| Specifies the [logging level][logging_level] of the logs you would like to collect for your logging pipeline. Defaults to 0 which is `logging.NOTSET`. ||
64
-
|`logger_name`| Specifies the [logger name][logger_name_hierarchy_doc] under which logging will be instrumented. Defaults to "" which corresponds to the root logger. ||
65
-
|`logging_export_interval_ms`| Specifies the logging export interval in milliseconds. Defaults to 5000. |`OTEL_BLRP_SCHEDULE_DELAY`|
66
-
|`metric_readers`| Specifies the [metric readers][ot_metric_reader] that you would like to use for your metric pipeline. Accepts a list of [metric readers][ot_sdk_python_metric_reader]. ||
67
-
|`views`| Specifies the list of [views][opentelemetry_spec_view] to configure for the metric pipeline. See [here][ot_sdk_python_view_examples] for example usage. ||
68
-
|`sampling_ratio`| Specifies the ratio of distributed tracing telemetry to be [sampled][application_insights_sampling]. Accepted values are in the range [0,1]. Defaults to 1.0, meaning no telemetry is sampled out. |`OTEL_TRACES_SAMPLER_ARG`|
69
-
|`tracing_export_interval_ms`| Specifies the distributed tracing export interval in milliseconds. Defaults to 5000. |`OTEL_BSP_SCHEDULE_DELAY`|
70
-
|`instrumentation_config`| Specifies a dictionary of kwargs that will be applied to instrumentation configuration. You can specify which instrumentation you want to configure by name in the key field and value as a dictionary representing `kwargs` for the corresponding instrumentation. Refer to the `Supported Library` section [above](#officially-supported-instrumentations) for the list of supported library names. ||
71
-
72
-
Example for use of `instrumentation_config`:
73
-
```python
74
-
...
75
-
configure_azure_monitor(
76
-
connection_string="<your-connection-string>",
77
-
instrumentation_config={
78
-
"flask": {
79
-
"excluded_urls": "http://localhost:8080/ignore",
80
-
},
81
-
"requests": {
82
-
"excluded_urls": "http://example.com"
83
-
}
84
-
}
85
-
)
86
-
...
87
-
```
88
58
89
-
Take a look at the specific [instrumenation][ot_instrumentations] documentation for available configurations.
59
+
60
+
You can configure further with [OpenTelemetry environment variables][ot_env_vars] such as:
61
+
| Environment Variable | Description |
62
+
|-------------|----------------------|
63
+
|[OTEL_SERVICE_NAME][opentelemetry_spec_service_name], [OTEL_RESOURCE_ATTRIBUTES][opentelemetry_spec_resource_attributes]| Specifies the OpenTelemetry [resource][opentelemetry_spec_resource] associated with your application. |
64
+
|`OTEL_LOGS_EXPORTER`| If set to `None`, disables collection and export of logging telemetry. |
65
+
|`OTEL_METRICS_EXPORTER`| If set to `None`, disables collection and export of metric telemetry. |
66
+
|`OTEL_TRACES_EXPORTER`| If set to `None`, disables collection and export of distributed tracing telemetry. |
67
+
|`OTEL_BLRP_SCHEDULE_DELAY`| Specifies the logging export interval in milliseconds. Defaults to 5000. |
68
+
|`OTEL_BSP_SCHEDULE_DELAY`| Specifies the distributed tracing export interval in milliseconds. Defaults to 5000. |
69
+
|`OTEL_TRACES_SAMPLER_ARG`| Specifies the ratio of distributed tracing telemetry to be [sampled][application_insights_sampling]. Accepted values are in the range [0,1]. Defaults to 1.0, meaning no telemetry is sampled out. |
70
+
<!-- TODO: add once OTEL_LOG_LEVEL is supported in sdk -->
71
+
<!-- Specifies the [logging level][logging_level] of the logs you would like to collect for your logging pipeline. Defaults to 0 which is `logging.NOTSET`. | OTEL_LOG_LEVEL | -->
This function works as a configuration layer that allows the
68
56
end user to configure OpenTelemetry and Azure monitor components. The
69
57
configuration can be done via arguments passed to this function.
70
58
:keyword str connection_string: Connection string for your Application Insights resource.
71
-
:keyword Sequence[str] exclude_instrumentations: Specifies instrumentations you want to disable.
72
-
:keyword Resource resource: Specified the OpenTelemetry [resource][opentelemetry_spec_resource] associated with your application.
73
-
:keyword bool disable_logging: If set to `True`, disables collection and export of logging telemetry. Defaults to `False`.
74
-
:keyword bool disable_metrics: If set to `True`, disables collection and export of metric telemetry. Defaults to `False`.
75
-
:keyword bool disable_tracing: If set to `True`, disables collection and export of distributed tracing telemetry. Defaults to `False`.
76
-
:keyword int logging_level: Specifies the logging of the logs you would like to collect for your logging pipeline.
77
-
:keyword str logger_name: Specifies the logger name under which logging will be instrumented. Defaults to "" which corresponds to the root logger.
78
-
:keyword int logging_export_interval_ms: Specifies the logging export interval in milliseconds. Defaults to 5000.
79
-
:keyword Sequence[MetricReader] metric_readers: Specifies the metric readers that you would like to use for your metric pipeline.
80
-
:keyword Sequence[View] views: Specifies the list of views to configure for the metric pipeline.
81
-
:keyword float sampling_ratio: Specifies the ratio of distributed tracing telemetry to be sampled. Accepted values are in the range [0,1]. Defaults to 1.0, meaning no telemetry is sampled out.
82
-
:keyword int tracing_export_interval_ms: Specifies the distributed tracing export interval in milliseconds. Defaults to 5000.
83
-
:keyword InstrumentationConfig instrumentation_config: Specifies a dictionary of kwargs that will be applied to instrumentation configuration. You can specify which instrumentation you want to
84
-
configure by name in the key field and value as a dictionary representing `kwargs` for the corresponding instrumentation.
85
-
Refer to the `Supported Library` section of https://github.com/microsoft/ApplicationInsights-Python/tree/main/azure-monitor-opentelemetry#officially-supported-instrumentations for the list of suppoprted library names.
59
+
:keyword ManagedIdentityCredential/ClientSecretCredential credential: Token credential, such as ManagedIdentityCredential or ClientSecretCredential, used for Azure Active Directory (AAD) authentication. Defaults to None.
86
60
:keyword bool disable_offline_storage: Boolean value to determine whether to disable storing failed telemetry records for retry. Defaults to `False`.
87
61
:keyword str storage_directory: Storage directory in which to store retry files. Defaults to `<tempfile.gettempdir()>/Microsoft/AzureMonitor/opentelemetry-python-<your-instrumentation-key>`.
0 commit comments