Skip to content

Commit

Permalink
Update python getting started to use OTLP http/protobuf (#523)
Browse files Browse the repository at this point in the history
* Update python getting started to use OTLP http/protobuf

* Use http/protobuf for metrics and logs
  • Loading branch information
jack-berg authored Jan 19, 2024
1 parent 54606e3 commit d939041
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions getting-started-guides/python/Instrumented/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ cd ./getting-started-guides/python/instrumented/
6. Install dependencies listed in `requirements.txt`
7. To send telemetry data to New Relic, set the following environment variables
```shell
OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp.nr-data.net:4317"
OTEL_EXPORTER_OTLP_ENDPOINT="https://otlp.nr-data.net"
OTEL_EXPORTER_OTLP_HEADERS="api-key=[YOUR_INGEST_KEY]"
```
* Make sure to use your [ingest license key](https://docs.newrelic.com/docs/apis/intro-apis/new-relic-api-keys/#license-key)
* If your account is based in the EU, set the endpoint to: https://otlp.eu01.nr-data.net:4317
* If your account is based in the EU, set the endpoint to: https://otlp.eu01.nr-data.net
8. Set this environment variable to name the demo app:
```shell
OTEL_SERVICE_NAME=getting-started-python
Expand Down
6 changes: 3 additions & 3 deletions getting-started-guides/python/Instrumented/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
from opentelemetry.trace.status import Status, StatusCode

# Initialize tracing and an exporter that can send data to an OTLP endpoint
Expand All @@ -29,7 +29,7 @@
from opentelemetry import metrics
from opentelemetry.sdk.metrics import MeterProvider
from opentelemetry.sdk.metrics.export import PeriodicExportingMetricReader
from opentelemetry.exporter.otlp.proto.grpc.metric_exporter import OTLPMetricExporter
from opentelemetry.exporter.otlp.proto.http.metric_exporter import OTLPMetricExporter

# Initialize metering and an exporter that can send data to an OTLP endpoint
# SELECT count(`http.server.active_requests`) FROM Metric FACET `service.name` TIMESERIES
Expand All @@ -46,7 +46,7 @@
from opentelemetry import _logs
from opentelemetry.sdk._logs import LoggerProvider, LoggingHandler
from opentelemetry.sdk._logs.export import BatchLogRecordProcessor
from opentelemetry.exporter.otlp.proto.grpc._log_exporter import OTLPLogExporter
from opentelemetry.exporter.otlp.proto.http._log_exporter import OTLPLogExporter

# Initialize logging and an exporter that can send data to an OTLP endpoint by attaching OTLP handler to root logger
# SELECT * FROM Log WHERE instrumentation.provider='opentelemetry'
Expand Down

0 comments on commit d939041

Please sign in to comment.