Skip to content

Commit b0ff65d

Browse files
committed
2 parents c05bbe8 + 9bd01fa commit b0ff65d

File tree

15 files changed

+33
-31
lines changed

15 files changed

+33
-31
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
([#256](https://github.com/microsoft/ApplicationInsights-Python/pull/256))
1313
- Change instrumentation config to use TypedDict InstrumentationConfig
1414
([#259](https://github.com/microsoft/ApplicationInsights-Python/pull/259))
15+
- Change interval params to use `_ms` as suffix
16+
([#260](https://github.com/microsoft/ApplicationInsights-Python/pull/260))
1517

1618
## [1.0.0b10](https://github.com/microsoft/ApplicationInsights-Python/releases/tag/v1.0.0b10) - 2023-02-23
1719

azure-monitor-opentelemetry/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,11 @@ Take a look at the specific [instrumenation][ot_instrumentations] documentation
7474
* resource - Specified the OpenTelemetry [resource][opentelemetry_spec_resource] associated with your application. See [this][ot_sdk_python_resource] for default behavior.
7575
* logging_level - Specifies the [logging level][logging_level] of the logs you would like to collect for your logging pipeline. Defaults to logging.NOTSET.
7676
* logger_name = Specifies the [logger name][logger_name_hierarchy_doc] under which logging will be instrumented. Defaults to "" which corresponds to the root logger.
77-
* logging_export_interval_millis - Specifies the logging export interval in milliseconds. Defaults to 5000.
77+
* logging_export_interval_ms - Specifies the logging export interval in milliseconds. Defaults to 5000.
7878
* 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].
7979
* 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.
8080
* 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.
81-
* tracing_export_interval_millis - Specifies the distributed tracing export interval in milliseconds. Defaults to 5000.
81+
* tracing_export_interval_ms - Specifies the distributed tracing export interval in milliseconds. Defaults to 5000.
8282

8383
#### Azure monitor OpenTelemetry Exporter configurations
8484

azure-monitor-opentelemetry/azure/monitor/opentelemetry/_configure.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,11 @@ def configure_azure_monitor(**kwargs) -> None:
6060
:keyword bool disable_tracing: If set to `True`, disables collection and export of distributed tracing telemetry. Defaults to `False`.
6161
:keyword int logging_level: Specifies the logging of the logs you would like to collect for your logging pipeline.
6262
:keyword str logger_name: Specifies the logger name under which logging will be instrumented. Defaults to "" which corresponds to the root logger.
63-
:keyword int logging_export_interval_millis: Specifies the logging export interval in milliseconds. Defaults to 5000.
63+
:keyword int logging_export_interval_ms: Specifies the logging export interval in milliseconds. Defaults to 5000.
6464
:keyword Sequence[MetricReader] metric_readers: Specifies the metric readers that you would like to use for your metric pipeline.
6565
:keyword Sequence[View] views: Specifies the list of views to configure for the metric pipeline.
6666
: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.
67-
:keyword int tracing_export_interval_millis: Specifies the distributed tracing export interval in milliseconds. Defaults to 5000.
67+
:keyword int tracing_export_interval_ms: Specifies the distributed tracing export interval in milliseconds. Defaults to 5000.
6868
:keyword InstrumentationConfig instrumentation_config: Specifies a dictionary of kwargs that will be applied to instrumentation configuration. You can specify which instrumentation you want to
6969
configure by name in the key field and value as a dictionary representing `kwargs` for the corresponding instrumentation.
7070
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.
@@ -109,8 +109,8 @@ def _setup_tracing(
109109
resource: Resource, configurations: Dict[str, ConfigurationValue]
110110
):
111111
sampling_ratio = configurations.get("sampling_ratio", 1.0)
112-
tracing_export_interval_millis = configurations.get(
113-
"tracing_export_interval_millis", 5000
112+
tracing_export_interval_ms = configurations.get(
113+
"tracing_export_interval_ms", 5000
114114
)
115115
tracer_provider = TracerProvider(
116116
sampler=ApplicationInsightsSampler(sampling_ratio=sampling_ratio),
@@ -120,7 +120,7 @@ def _setup_tracing(
120120
trace_exporter = AzureMonitorTraceExporter(**configurations)
121121
span_processor = BatchSpanProcessor(
122122
trace_exporter,
123-
schedule_delay_millis=tracing_export_interval_millis,
123+
schedule_delay_millis=tracing_export_interval_ms,
124124
)
125125
get_tracer_provider().add_span_processor(span_processor)
126126

@@ -130,15 +130,15 @@ def _setup_logging(
130130
):
131131
logger_name = configurations.get("logger_name", "")
132132
logging_level = configurations.get("logging_level", NOTSET)
133-
logging_export_interval_millis = configurations.get(
134-
"logging_export_interval_millis", 5000
133+
logging_export_interval_ms = configurations.get(
134+
"logging_export_interval_ms", 5000
135135
)
136136
logger_provider = LoggerProvider(resource=resource)
137137
set_logger_provider(logger_provider)
138138
log_exporter = AzureMonitorLogExporter(**configurations)
139139
log_record_processor = BatchLogRecordProcessor(
140140
log_exporter,
141-
schedule_delay_millis=logging_export_interval_millis,
141+
schedule_delay_millis=logging_export_interval_ms,
142142
)
143143
get_logger_provider().add_log_record_processor(log_record_processor)
144144
handler = LoggingHandler(

azure-monitor-opentelemetry/samples/logging/logs_with_traces.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
logging_level=WARNING,
1616
disable_metrics=True,
1717
instrumentations=["flask"],
18-
tracing_export_interval_millis=15000,
18+
tracing_export_interval_ms=15000,
1919
)
2020

2121
logger = getLogger(__name__)

azure-monitor-opentelemetry/samples/tracing/db_psycopg2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
connection_string="<your-connection-string>",
1212
disable_logging=True,
1313
disable_metrics=True,
14-
tracing_export_interval_millis=15000,
14+
tracing_export_interval_ms=15000,
1515
)
1616

1717
# Database calls using the psycopg2 library will be automatically captured

azure-monitor-opentelemetry/samples/tracing/django/sample/example/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
connection_string="<your-connection-string>",
1313
disable_logging=True,
1414
disable_metrics=True,
15-
tracing_export_interval_millis=15000,
15+
tracing_export_interval_ms=15000,
1616
)
1717

1818

azure-monitor-opentelemetry/samples/tracing/http_fastapi.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"excluded_urls": "http://127.0.0.1:8000/exclude",
1717
}
1818
},
19-
tracing_export_interval_millis=15000,
19+
tracing_export_interval_ms=15000,
2020
)
2121

2222
app = fastapi.FastAPI()

azure-monitor-opentelemetry/samples/tracing/http_flask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"excluded_urls": "http://localhost:8080/ignore",
1717
}
1818
},
19-
tracing_export_interval_millis=15000,
19+
tracing_export_interval_ms=15000,
2020
)
2121

2222
app = flask.Flask(__name__)

azure-monitor-opentelemetry/samples/tracing/http_requests.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
"excluded_urls": "http://example.com",
2222
}
2323
},
24-
tracing_export_interval_millis=15000,
24+
tracing_export_interval_ms=15000,
2525
)
2626

2727
tracer = trace.get_tracer(__name__)

azure-monitor-opentelemetry/samples/tracing/http_urllib.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
connection_string="<your-connection-string>",
1717
disable_logging=True,
1818
disable_metrics=True,
19-
tracing_export_interval_millis=15000,
19+
tracing_export_interval_ms=15000,
2020
)
2121

2222
tracer = trace.get_tracer(__name__)

azure-monitor-opentelemetry/samples/tracing/http_urllib3.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
connection_string="<your-connection-string>",
1717
disable_logging=True,
1818
disable_metrics=True,
19-
tracing_export_interval_millis=15000,
19+
tracing_export_interval_ms=15000,
2020
)
2121

2222
http = urllib3.PoolManager()

azure-monitor-opentelemetry/samples/tracing/manual.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
configure_azure_monitor(
1111
connection_string="<your-connection-string>",
12-
tracing_export_interval_millis=15000,
12+
tracing_export_interval_ms=15000,
1313
disable_logging=True,
1414
disable_metrics=True,
1515
)

azure-monitor-opentelemetry/samples/tracing/sampling.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
# Sampling ratio of between 0 and 1 inclusive
1313
# 0.1 means approximately 10% of your traces are sent
1414
sampling_ratio=0.1,
15-
tracing_export_interval_millis=15000,
15+
tracing_export_interval_ms=15000,
1616
disable_logging=True,
1717
disable_metrics=True,
1818
)

azure-monitor-opentelemetry/samples/tracing/simple.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
ResourceAttributes.SERVICE_INSTANCE_ID: "simple_tracing_instance",
1717
}
1818
),
19-
tracing_export_interval_millis=15000,
19+
tracing_export_interval_ms=15000,
2020
disable_logging=True,
2121
disable_metrics=True,
2222
)

azure-monitor-opentelemetry/tests/configuration/test_configure.py

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ def test_configure_azure_monitor(
5555
"disable_tracing": False,
5656
"disable_logging": False,
5757
"disable_metrics": False,
58-
"logging_export_interval_millis": 10000,
58+
"logging_export_interval_ms": 10000,
5959
"logging_level": "test_logging_level",
6060
"logger_name": "test_logger_name",
6161
"metric_readers": "test_metric_readers",
6262
"service_name": "test_service_name",
6363
"service_namespace": "test_namespace",
6464
"service_instance_id": "test_id",
6565
"sampling_ratio": 0.5,
66-
"tracing_export_interval_millis": 15000,
66+
"tracing_export_interval_ms": 15000,
6767
"views": "test_views",
6868
}
6969
resource_init_mock = Mock()
@@ -103,14 +103,14 @@ def test_configure_azure_monitor_disable_tracing(
103103
"disable_tracing": True,
104104
"disable_logging": False,
105105
"disable_metrics": False,
106-
"logging_export_interval_millis": 10000,
106+
"logging_export_interval_ms": 10000,
107107
"logging_level": "test_logging_level",
108108
"logger_name": "test_logger_name",
109109
"service_name": "test_service_name",
110110
"service_namespace": "test_namespace",
111111
"service_instance_id": "test_id",
112112
"sampling_ratio": 0.5,
113-
"tracing_export_interval_millis": 15000,
113+
"tracing_export_interval_ms": 15000,
114114
"views": "test_views",
115115
}
116116
resource_init_mock = Mock()
@@ -150,14 +150,14 @@ def test_configure_azure_monitor_disable_logging(
150150
"disable_tracing": False,
151151
"disable_logging": True,
152152
"disable_metrics": False,
153-
"logging_export_interval_millis": 10000,
153+
"logging_export_interval_ms": 10000,
154154
"logging_level": "test_logging_level",
155155
"logger_name": "test_logger_name",
156156
"service_name": "test_service_name",
157157
"service_namespace": "test_namespace",
158158
"service_instance_id": "test_id",
159159
"sampling_ratio": 0.5,
160-
"tracing_export_interval_millis": 15000,
160+
"tracing_export_interval_ms": 15000,
161161
"views": "test_views",
162162
}
163163
resource_init_mock = Mock()
@@ -197,13 +197,13 @@ def test_configure_azure_monitor_disable_metrics(
197197
"disable_tracing": False,
198198
"disable_logging": False,
199199
"disable_metrics": True,
200-
"logging_export_interval_millis": 10000,
200+
"logging_export_interval_ms": 10000,
201201
"logging_level": "test_logging_level",
202202
"service_name": "test_service_name",
203203
"service_namespace": "test_namespace",
204204
"service_instance_id": "test_id",
205205
"sampling_ratio": 0.5,
206-
"tracing_export_interval_millis": 15000,
206+
"tracing_export_interval_ms": 15000,
207207
"views": "test_views",
208208
}
209209
resource_init_mock = Mock()
@@ -271,7 +271,7 @@ def test_setup_tracing(
271271
"connection_string": "test_cs",
272272
"disable_tracing": False,
273273
"sampling_ratio": 0.5,
274-
"tracing_export_interval_millis": 15000,
274+
"tracing_export_interval_ms": 15000,
275275
}
276276
_setup_tracing(resource_mock, configurations)
277277
sampler_mock.assert_called_once_with(sampling_ratio=0.5)
@@ -336,7 +336,7 @@ def test_setup_logging(
336336
configurations = {
337337
"connection_string": "test_cs",
338338
"disable_logging": False,
339-
"logging_export_interval_millis": 10000,
339+
"logging_export_interval_ms": 10000,
340340
"logging_level": "test_logging_level",
341341
"logger_name": "test_logger_name",
342342
}

0 commit comments

Comments
 (0)