Skip to content

Commit 6de9c84

Browse files
authored
Merge pull request #175277 from lzchen/oc
[OC Python] Update versions supported, tab fixes
2 parents 0fca887 + 70f1830 commit 6de9c84

File tree

1 file changed

+31
-31
lines changed

1 file changed

+31
-31
lines changed

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

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ You may have noted that OpenCensus is converging into [OpenTelemetry](https://op
2222
## Prerequisites
2323

2424
- 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+.
2626
- Create an Application Insights [resource](./create-new-resource.md). You'll be assigned your own instrumentation key (ikey) for your resource.
2727

2828
## Introducing Opencensus Python SDK
@@ -344,47 +344,47 @@ Opencensus Python SDK allows adding custom dimensions to your metrics telemetry
344344

345345
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.
346346

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+
```
353353

354354
1. For a specific `View`, specify the tags you want to use when recording metrics with that view via the tag key.
355355

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+
```
365365

366366
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.
367367

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+
```
375375

376376
1. Under the `customMetrics` table, all metrics records emitted using the `prompt_view` will have custom dimensions `{"url":"http://example.com"}`.
377377

378378
1. To produce tags with different values using the same keys, create new tag maps for them.
379379

380-
```python
381-
...
382-
tmap = tag_map_module.TagMap()
383-
tmap2 = tag_map_module.TagMap()
384-
tmap.insert("url", "http://example.com")
385-
tmap2.insert("url", "https://www.wikipedia.org/wiki/")
386-
...
387-
```
380+
```python
381+
...
382+
tmap = tag_map_module.TagMap()
383+
tmap2 = tag_map_module.TagMap()
384+
tmap.insert("url", "http://example.com")
385+
tmap2.insert("url", "https://www.wikipedia.org/wiki/")
386+
...
387+
```
388388

389389
#### Performance counters
390390

0 commit comments

Comments
 (0)