Skip to content

Commit e17c797

Browse files
Merge pull request #227779 from lzchen/patch-3
Update opencensus document about metrics interval
2 parents 17636d1 + 91ddd91 commit e17c797

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

articles/azure-monitor/app/opencensus-python.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,9 @@ OpenCensus.stats supports four aggregation methods but provides partial support
321321

322322
# TODO: replace the all-zero GUID with your instrumentation key.
323323
exporter = metrics_exporter.new_metrics_exporter(
324-
connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000')
324+
connection_string='InstrumentationKey=00000000-0000-0000-0000-000000000000',
325+
export_interval=60, # Application Insights backend assumes aggregation on a 60s interval
326+
)
325327
# You can also instantiate the exporter directly if you have the environment variable
326328
# `APPLICATIONINSIGHTS_CONNECTION_STRING` configured
327329
# exporter = metrics_exporter.new_metrics_exporter()
@@ -343,7 +345,7 @@ OpenCensus.stats supports four aggregation methods but provides partial support
343345
main()
344346
```
345347

346-
1. The exporter sends metric data to Azure Monitor at a fixed interval. The default is every 15 seconds. To modify the export interval, pass in `export_interval` as a parameter in seconds to `new_metrics_exporter()`. We're tracking a single metric, so this metric data, with whatever value and time stamp it contains, is sent every interval. The value is cumulative, can only increase, and resets to 0 on restart.
348+
1. The exporter sends metric data to Azure Monitor at a fixed interval. You must set this value to 60s as Application Insights backend assumes aggregation of metrics points on a 60s time interval. We're tracking a single metric, so this metric data, with whatever value and time stamp it contains, is sent every interval. The data is cumulative, can only increase, and resets to 0 on restart.
347349

348350
You can find the data under `customMetrics`, but the `customMetrics` properties `valueCount`, `valueSum`, `valueMin`, `valueMax`, and `valueStdDev` aren't effectively used.
349351

@@ -519,7 +521,7 @@ Each exporter accepts the same arguments for configuration, passed through the c
519521
`connection_string`| The connection string used to connect to your Azure Monitor resource. Takes priority over `instrumentation_key`.|
520522
`credential`| Credential class used by Azure Active Directory authentication. See the "Authentication" section that follows.|
521523
`enable_standard_metrics`| Used for `AzureMetricsExporter`. Signals the exporter to send [performance counter](../essentials/app-insights-metrics.md#performance-counters) metrics automatically to Azure Monitor. Defaults to `True`.|
522-
`export_interval`| Used to specify the frequency in seconds of exporting. Defaults to `15s`.|
524+
`export_interval`| Used to specify the frequency in seconds of exporting. Defaults to `15s`. For metrics you MUST set this to 60s or else your metric aggregations will not make sense in the metrics explorer.|
523525
`grace_period`| Used to specify the timeout for shutdown of exporters in seconds. Defaults to `5s`.|
524526
`instrumentation_key`| The instrumentation key used to connect to your Azure Monitor resource.|
525527
`logging_sampling_rate`| Used for `AzureLogHandler` and `AzureEventHandler`. Provides a sampling rate [0,1.0] for exporting logs/events. Defaults to `1.0`.|

0 commit comments

Comments
 (0)