@@ -166,8 +166,11 @@ The **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Mo
166
166
167
167
def main ():
168
168
# Enable metrics
169
- # Set the interval in seconds in which you want to send metrics
170
- exporter = metrics_exporter.new_metrics_exporter(connection_string = ' InstrumentationKey=<your-instrumentation-key-here>' )
169
+ # Set the interval in seconds to 60s, which is the time interval application insights
170
+ # aggregates your metrics
171
+ exporter = metrics_exporter.new_metrics_exporter(
172
+ connection_string = ' InstrumentationKey=<your-instrumentation-key-here>'
173
+ )
171
174
view_manager.register_exporter(exporter)
172
175
173
176
view_manager.register_view(CARROTS_VIEW )
@@ -176,7 +179,6 @@ The **Azure Monitor Metrics Exporter** allows you to export metrics to `Azure Mo
176
179
177
180
mmap.measure_int_put(CARROTS_MEASURE , 1000 )
178
181
mmap.record(tmap)
179
- # Default export interval is every 15.0s
180
182
181
183
print (" Done recording metrics" )
182
184
@@ -196,10 +198,13 @@ The exporter also includes a set of performance counters that are exported to Az
196
198
from opencensus.ext.azure import metrics_exporter
197
199
198
200
def main ():
199
- # All you need is the next line . You can disable performance counters by
201
+ # Performance counters are sent by default . You can disable performance counters by
200
202
# passing in enable_standard_metrics=False into the constructor of
201
203
# new_metrics_exporter()
202
- _exporter = metrics_exporter.new_metrics_exporter(connection_string = ' InstrumentationKey=<your-instrumentation-key-here>' )
204
+ _exporter = metrics_exporter.new_metrics_exporter(
205
+ connection_string = ' InstrumentationKey=<your-instrumentation-key-here>' ,
206
+ export_interval = 60 ,
207
+ )
203
208
204
209
for i in range (100 ):
205
210
print (psutil.virtual_memory())
@@ -256,8 +261,12 @@ Modifying Metrics
256
261
257
262
def main ():
258
263
# Enable metrics
259
- # Set the interval in seconds in which you want to send metrics
260
- exporter = metrics_exporter.new_metrics_exporter(connection_string = ' InstrumentationKey=<your-instrumentation-key-here>' )
264
+ # Set the interval in seconds to 60s, which is the time interval application insights
265
+ # aggregates your metrics
266
+ exporter = metrics_exporter.new_metrics_exporter(
267
+ connection_string = ' InstrumentationKey=<your-instrumentation-key-here>' ,
268
+ export_interval = 60 ,
269
+ )
261
270
exporter.add_telemetry_processor(callback_function)
262
271
view_manager.register_exporter(exporter)
263
272
@@ -267,7 +276,6 @@ Modifying Metrics
267
276
268
277
mmap.measure_int_put(CARROTS_MEASURE , 1000 )
269
278
mmap.record(tmap)
270
- # Default export interval is every 15.0s
271
279
272
280
print (" Done recording metrics" )
273
281
0 commit comments