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
The exporter for Azure Monitor allows you to export tracing data utilizing the OpenTelemetry SDK and send telemetry data to Azure Monitor for applications written in Python.
5
+
The exporter for Azure Monitor allows you to export data utilizing the OpenTelemetry SDK and send telemetry data to Azure Monitor for applications written in Python.
@@ -25,10 +25,19 @@ To use this package, you must have:
25
25
26
26
### Instantiate the client
27
27
28
-
Interaction with Azure monitor exporter starts with an instance of the `AzureMonitorTraceExporter` class. You will need a **connection_string** to instantiate the object.
28
+
Interaction with Azure monitor exporter starts with an instance of the `AzureMonitorTraceExporter` class for distributed tracing or `AzureMonitorTraceExporter` for logging. You will need a **connection_string** to instantiate the object.
29
29
Please find the samples linked below for demonstration as to how to construct the exporter using a connection string.
30
30
31
-
#### [Create Exporter from connection string][sample_authenticate_client_connstr]
31
+
#### Logging
32
+
33
+
```Python
34
+
from azure.monitor.opentelemetry.exporter import AzureMonitorLogExporter
You can also instantiate the exporter directly via the constructor. In this case, the connection string will be automatically populated from the `APPLICATIONINSIGHTS_CONNECTION_STRING` environment variable.
41
50
51
+
```python
52
+
from azure.monitor.opentelemetry.exporter import AzureMonitorLogExporter
53
+
exporter = AzureMonitorLogExporter()
54
+
```
55
+
42
56
```python
43
57
from azure.monitor.opentelemetry.exporter import AzureMonitorTraceExporter
44
58
exporter = AzureMonitorTraceExporter()
@@ -52,26 +66,164 @@ Some of the key concepts for the Azure monitor exporter include:
52
66
53
67
*[Instrumentation][instrumentation_library]: The ability to call the opentelemetry API directly by any application is facilitated by instrumentation. A library that enables OpenTelemetry observability for another library is called an instrumentation Library.
54
68
55
-
*[Trace][trace_concept]: Trace refers to distributed tracing. It can be thought of as a directed acyclic graph (DAG) of Spans, where the edges between Spans are defined as parent/child relationship.
69
+
*[Log][log_concept]: Log refers to capturing of logging, exception and events.
70
+
71
+
*[LogRecord][log_record]: Represents a log record emitted from a supported logging library.
72
+
73
+
*[LogEmitter][log_emitter]: Converts a `LogRecord` into a readable `LogData`, and will be pushed through the SDK to be exported.
74
+
75
+
*[LogEmitter Provider][log_emitter_provider]: Provides a `LogEmitter` for the given instrumentation library.
76
+
77
+
*[LogProcessor][log_processor]: Inteface to hook the log record emitting action.
78
+
79
+
*[LoggingHandler][logging_handler]: A handler class which writes logging records in OpenTelemetry format from the standard Python `logging` library.
80
+
81
+
*[AzureMonitorLogExporter][log_reference]: This is the class that is initialized to send logging related telemetry to Azure Monitor.
82
+
83
+
*[Trace][trace_concept]: Trace refers to distributed tracing. It can be thought of as a directed acyclic graph (DAG) of `Span`s, where the edges between `Span`s are defined as parent/child relationship.
84
+
85
+
*[Span][span]: Represents a single operation within a `Trace`. Can be nested to form a trace tree. Each trace contains a root span, which typically describes the entire operation and, optionally, one ore more sub-spans for its sub-operations.
86
+
87
+
*[Tracer][tracer]: Responsible for creating `Span`s.
56
88
57
89
*[Tracer Provider][tracer_provider]: Provides a `Tracer` for use by the given instrumentation library.
58
90
59
91
*[Span Processor][span_processor]: A span processor allows hooks for SDK's `Span` start and end method invocations. Follow the link for more information.
60
92
61
-
*[Sampling][sampler_ref]: Sampling is a mechanism to control the noise and overhead introduced by OpenTelemetry by reducing the number of samples of traces collected and sent to the backend.
93
+
*[AzureMonitorTraceExporter][trace_reference]: This is the class that is initialized to send tracing related telemetry to Azure Monitor.
62
94
63
-
*[AzureMonitorTraceExporter][client_reference]: This is the class that is initialized to send tracing related telemetry to Azure Monitor.
95
+
*[Sampling][sampler_ref]: Sampling is a mechanism to control the noise and overhead introduced by OpenTelemetry by reducing the number of samples of traces collected and sent to the backend.
64
96
65
97
For more information about these resources, see [What is Azure Monitor?][product_docs].
66
98
67
99
## Examples
68
100
101
+
### Logging
102
+
103
+
The following sections provide several code snippets covering some of the most common tasks, including:
104
+
105
+
*[Exporting a log record](#export-hello-world-log)
Copy file name to clipboardExpand all lines: sdk/monitor/azure-monitor-opentelemetry-exporter/azure/monitor/opentelemetry/exporter/export/logs/__init__.py
0 commit comments