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-functions/opentelemetry-howto.md
+31-3Lines changed: 31 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -231,7 +231,10 @@ These instructions only apply for an OTLP exporter:
231
231
### [OTLP Exporter](#tab/otlp-export)
232
232
233
233
```text
234
-
azure.monitor.opentelemetry
234
+
opentelemetry-api
235
+
opentelemetry-sdk
236
+
opentelemetry-exporter-otlp
237
+
opentelemetry-instrumentation-logging
235
238
```
236
239
---
237
240
@@ -245,10 +248,35 @@ These instructions only apply for an OTLP exporter:
245
248
```
246
249
### [OTLP Exporter](#tab/otlp-export)
247
250
251
+
Traces, metrics, and logs being exported using OpenTelemetry must be configured manually. For more information, see [Instrumentation](https://opentelemetry.io/docs/languages/python/instrumentation/) for Python.
252
+
253
+
This is a simple implementaton for exporting logs:
254
+
248
255
```python
249
-
from azure.monitor.opentelemetry import configure_azure_monitor
250
-
configure_azure_monitor()
256
+
logging.basicConfig(level=logging.DEBUG)
257
+
258
+
from opentelemetry import _logs
259
+
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
260
+
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
261
+
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter
262
+
263
+
# Initialize logging and an exporter that can send data to an OTLP endpoint by attaching OTLP handler to root logger
264
+
# SELECT * FROM Log WHERE instrumentation.provider='opentelemetry'
Review the [OpenTelemetry Logging SDK](https://opentelemetry-python.readthedocs.io/en/stable/sdk/_logs.html) to learn how to use OpenTelemetry components to collect logs.
0 commit comments