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
Copy file name to clipboardExpand all lines: articles/azure-monitor/app/opencensus-python.md
+31-31Lines changed: 31 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ You may have noted that OpenCensus is converging into [OpenTelemetry](https://op
22
22
## Prerequisites
23
23
24
24
- An Azure subscription. If you don't have an Azure subscription, create a [free account](https://azure.microsoft.com/free/) before you begin.
25
-
- Python installation. This article uses [Python 3.7.0](https://www.python.org/downloads/release/python-370/), although other versions will likely work with minor changes. The Opencensus Python SDK only supports Python v2.7 and v3.4-v3.7.
25
+
- Python installation. This article uses [Python 3.7.0](https://www.python.org/downloads/release/python-370/), although other versions will likely work with minor changes. The Opencensus Python SDK only supports Python v2.7 and v3.4+.
26
26
- Create an Application Insights [resource](./create-new-resource.md). You'll be assigned your own instrumentation key (ikey) for your resource.
27
27
28
28
## Introducing Opencensus Python SDK
@@ -344,47 +344,47 @@ Opencensus Python SDK allows adding custom dimensions to your metrics telemetry
344
344
345
345
1. Insert the tags that you want to use into the tag map. The tag map acts like a sort of "pool" of all available tags you can use.
346
346
347
-
```python
348
-
...
349
-
tmap = tag_map_module.TagMap()
350
-
tmap.insert("url", "http://example.com")
351
-
...
352
-
```
347
+
```python
348
+
...
349
+
tmap = tag_map_module.TagMap()
350
+
tmap.insert("url", "http://example.com")
351
+
...
352
+
```
353
353
354
354
1. For a specific `View`, specify the tags you want to use when recording metrics with that view via the tag key.
355
355
356
-
```python
357
-
...
358
-
prompt_view = view_module.View("prompt view",
359
-
"number of prompts",
360
-
["url"], # <-- A sequence of tag keys used to specify which tag key/value to use from the tag map
361
-
prompt_measure,
362
-
aggregation_module.CountAggregation())
363
-
...
364
-
```
356
+
```python
357
+
...
358
+
prompt_view = view_module.View("prompt view",
359
+
"number of prompts",
360
+
["url"], # <-- A sequence of tag keys used to specify which tag key/value to use from the tag map
361
+
prompt_measure,
362
+
aggregation_module.CountAggregation())
363
+
...
364
+
```
365
365
366
366
1. Be sure to use the tag map when recording in the measurement map. The tag keys that are specified in the `View` must be found in the tag map used to record.
367
367
368
-
```python
369
-
...
370
-
mmap = stats_recorder.new_measurement_map()
371
-
mmap.measure_int_put(prompt_measure, 1)
372
-
mmap.record(tmap) # <-- pass the tag map in here
373
-
...
374
-
```
368
+
```python
369
+
...
370
+
mmap = stats_recorder.new_measurement_map()
371
+
mmap.measure_int_put(prompt_measure, 1)
372
+
mmap.record(tmap) # <-- pass the tag map in here
373
+
...
374
+
```
375
375
376
376
1. Under the `customMetrics` table, all metrics records emitted using the `prompt_view` will have custom dimensions `{"url":"http://example.com"}`.
377
377
378
378
1. To produce tags with different values using the same keys, create new tag maps for them.
0 commit comments