diff --git a/CHANGELOG.md b/CHANGELOG.md index 64e6af0b..5f1e1fab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -30,6 +30,8 @@ ([#232](https://github.com/microsoft/ApplicationInsights-Python/pull/232)) - Add ability to pass custom configuration into instrumentations ([#235](https://github.com/microsoft/ApplicationInsights-Python/pull/235)) +- Fix export interval bug + ([#237](https://github.com/microsoft/ApplicationInsights-Python/pull/237)) ## [1.0.0b8](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b8) - 2022-09-26 diff --git a/azure-monitor-opentelemetry-distro/README.md b/azure-monitor-opentelemetry-distro/README.md index 8d630f9d..557fcb6a 100644 --- a/azure-monitor-opentelemetry-distro/README.md +++ b/azure-monitor-opentelemetry-distro/README.md @@ -51,10 +51,10 @@ You can use `configure_azure_monitor` to set up instrumentation for your app to * disable_tracing - If set to `True`, disables collection and export of distributed tracing telemetry. * logging_level - Specifies the [logging level][logging_level] of the Opentelemetry Logging Handler. Ex: logging.WARNING. * logger_name = Specifies the [logger name][logger_name_hierarchy_doc] under which all logging will be instrumented. Defaults to "" which corresponds to the root logger. -* logging_export_interval_millis - Specifies the logging export interval in milliseconds. Defaults to 30,000. +* logging_export_interval_millis - Specifies the logging export interval in milliseconds. Defaults to 5000. * views - Specifies the list of [views][opentelemetry_specification_view] to configure for the metric pipeline. See [here][ot_sdk_python_view_examples] for example usage. * 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. -* tracing_export_interval_millis - Specifies the distributed tracing export interval in milliseconds. Defaults to 30,000. +* tracing_export_interval_millis - Specifies the distributed tracing export interval in milliseconds. Defaults to 5000. #### Exporter configurations diff --git a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py b/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py index 118b8c0e..b4442823 100644 --- a/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py +++ b/azure-monitor-opentelemetry-distro/azure/monitor/opentelemetry/distro/__init__.py @@ -93,7 +93,7 @@ def _get_resource(configurations: Dict[str, Any]) -> Resource: def _setup_tracing(resource: Resource, configurations: Dict[str, Any]): sampling_ratio = configurations.get("sampling_ratio", 1.0) tracing_export_interval_millis = configurations.get( - "tracing_export_interval_millis", 30000 + "tracing_export_interval_millis", 5000 ) tracer_provider = TracerProvider( sampler=ApplicationInsightsSampler(sampling_ratio=sampling_ratio), @@ -103,7 +103,7 @@ def _setup_tracing(resource: Resource, configurations: Dict[str, Any]): trace_exporter = AzureMonitorTraceExporter(**configurations) span_processor = BatchSpanProcessor( trace_exporter, - export_timeout_millis=tracing_export_interval_millis, + schedule_delay_millis=tracing_export_interval_millis, ) get_tracer_provider().add_span_processor(span_processor) @@ -112,14 +112,14 @@ def _setup_logging(resource: Resource, configurations: Dict[str, Any]): logger_name = configurations.get("logger_name", "") logging_level = configurations.get("logging_level", NOTSET) logging_export_interval_millis = configurations.get( - "logging_export_interval_millis", 30000 + "logging_export_interval_millis", 5000 ) logger_provider = LoggerProvider(resource=resource) set_logger_provider(logger_provider) log_exporter = AzureMonitorLogExporter(**configurations) log_record_processor = BatchLogRecordProcessor( log_exporter, - export_timeout_millis=logging_export_interval_millis, + schedule_delay_millis=logging_export_interval_millis, ) get_logger_provider().add_log_record_processor(log_record_processor) handler = LoggingHandler( diff --git a/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py b/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py index 786aa8fc..6c4e0ca6 100644 --- a/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py +++ b/azure-monitor-opentelemetry-distro/tests/configuration/test_configure.py @@ -288,7 +288,7 @@ def test_setup_tracing( get_tracer_provider_mock.assert_called() trace_exporter_mock.assert_called_once() bsp_mock.assert_called_once_with( - trace_exp_init_mock, export_timeout_millis=15000 + trace_exp_init_mock, schedule_delay_millis=15000 ) tp_init_mock.add_span_processor(bsp_init_mock) @@ -352,7 +352,7 @@ def test_setup_logging( get_logger_provider_mock.assert_called() log_exporter_mock.assert_called_once() blrp_mock.assert_called_once_with( - log_exp_init_mock, export_timeout_millis=10000 + log_exp_init_mock, schedule_delay_millis=10000 ) lp_init_mock.add_log_record_processor.assert_called_once_with( blrp_init_mock