diff --git a/README.md b/README.md index 68244cd..248dece 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ import requests from azure_monitor import AzureMonitorSpanExporter from opentelemetry import trace -from opentelemetry.ext import http_requests +from opentelemetry.ext.requests import RequestsInstrumentor from opentelemetry.sdk.trace import TracerProvider from opentelemetry.sdk.trace.export import BatchExportSpanProcessor @@ -80,7 +80,7 @@ exporter = AzureMonitorSpanExporter( span_processor = BatchExportSpanProcessor(exporter) tracer_provider.add_span_processor(span_processor) -http_requests.enable(tracer_provider) +RequestsInstrumentor().instrument() response = requests.get(url="https://azure.microsoft.com/") ``` @@ -128,8 +128,6 @@ This example shows how to track a counter metric and send it as telemetry every * Alternatively, you can specify your `connection string` in an environment variable ``APPLICATIONINSIGHTS_CONNECTION_STRING``. ```python -import time - from azure_monitor import AzureMonitorMetricsExporter from opentelemetry import metrics from opentelemetry.sdk.metrics import Counter, MeterProvider @@ -154,5 +152,5 @@ requests_counter = meter.create_metric( testing_labels = {"environment": "testing"} requests_counter.add(25, testing_labels) -time.sleep(100) +input("...") ```