Skip to content

Commit c42ff72

Browse files
committed
Update opentelemetry-add-modify.md
1 parent a584f1f commit c42ff72

File tree

1 file changed

+49
-2
lines changed

1 file changed

+49
-2
lines changed

articles/azure-monitor/app/opentelemetry-add-modify.md

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ The following table represents the currently supported custom telemetry types:
324324
| **Python** | | | | | | | |
325325
|    OpenTelemetry API | | Yes | Yes | Yes | | Yes | |
326326
|    Python Logging Module | | | | | | | Yes |
327+
|    Azure Monitor Events Extension | Yes | | | | | | Yes |
327328

328329
> [!NOTE]
329330
> Application Insights Java 3.x listens for telemetry that's sent to the Application Insights [Classic API](api-custom-events-metrics.md). Similarly, Application Insights Node.js 3.x collects events created with the Application Insights [Classic API](api-custom-events-metrics.md). This makes upgrading easier and fills a gap in our custom telemetry support until all custom telemetry types are supported via the OpenTelemetry API.
@@ -1194,10 +1195,56 @@ with tracer.start_as_current_span("my request span", kind=SpanKind.SERVER) as sp
11941195

11951196
---
11961197

1197-
<!--
1198-
11991198
### Add Custom Events
12001199

1200+
The OpenTelemetry Events API is still under development. In the meantime, there are workarounds for each language to allow sending of "custom events", which populate the customEvents table in Application Insights.
1201+
1202+
#### [ASP.NET Core](#tab/aspnetcore)
1203+
1204+
Currently unavailable.
1205+
1206+
#### [.NET](#tab/net)
1207+
1208+
Currently unavailable.
1209+
1210+
#### [Java](#tab/java)
1211+
1212+
Currently unavailable.
1213+
1214+
#### [Node.js](#tab/nodejs)
1215+
1216+
Currently unavailable.
1217+
1218+
#### [Python](#tab/python)
1219+
1220+
Until the OpenTelemetry Events API is stable, the [Azure Monitor Events Extension](https://pypi.org/project/azure-monitor-events-extension/0.1.0/) can be used in conjunction with the Azure Monitor OpenTelemetry Distro to send customEvents to Application Insights.
1221+
1222+
Install the distro and the extension:
1223+
1224+
```console
1225+
pip install azure-monitor-opentelemetry
1226+
pip install azure-monitor-events-extension
1227+
```
1228+
1229+
Use the `track_event` API offered in the extension to send customEvents.
1230+
1231+
```python
1232+
...
1233+
from azure.monitor.events.extension import track_event
1234+
from azure.monitor.opentelemetry import configure_azure_monitor
1235+
1236+
configure_azure_monitor()
1237+
1238+
# Use the track_event() api to send custom event telemetry
1239+
# Takes event name and custom dimensions
1240+
track_event("Test event", {"key1": "value1", "key2": "value2"})
1241+
1242+
input()
1243+
...
1244+
```
1245+
1246+
<!--
1247+
12011248
#### Span Events
12021249
12031250
The OpenTelemetry Logs/Events API is still under development. In the meantime, you can use the OpenTelemetry Span API to create "Span Events", which populate the traces table in Application Insights. The string passed in to addEvent() is saved to the message field within the trace.

0 commit comments

Comments
 (0)