Skip to content

Ingest Your First Traces

This quickstart is for an application that is already running locally. If you are new to the stack, start with the installation guide and confirm that the OTel Collector is accepting telemetry on port 4317.

For an APM workflow, start with auto-instrumentation. It creates framework and client spans without requiring changes to application code. Use manual instrumentation when you need custom business spans or your framework is not supported.

Terminal window
pip install opentelemetry-distro opentelemetry-exporter-otlp
opentelemetry-bootstrap -a install
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_SERVICE_NAME="orders-service"
opentelemetry-instrument python app.py
Terminal window
npm install @opentelemetry/auto-instrumentations-node \
@opentelemetry/sdk-node \
@opentelemetry/exporter-trace-otlp-grpc
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_SERVICE_NAME="orders-service"
node --require @opentelemetry/auto-instrumentations-node/register app.js
Terminal window
curl -L -o opentelemetry-javaagent.jar \
https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/latest/download/opentelemetry-javaagent.jar
export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4317"
export OTEL_SERVICE_NAME="orders-service"
java -javaagent:opentelemetry-javaagent.jar -jar app.jar

See Auto-Instrumentation for .NET, Ruby, Go eBPF, configuration options, and supported libraries.

Use this smaller example when you want to see how spans are created explicitly.

Terminal window
pip install opentelemetry-api opentelemetry-sdk opentelemetry-exporter-otlp
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
exporter = OTLPSpanExporter(endpoint="http://localhost:4317", insecure=True)
provider = TracerProvider()
provider.add_span_processor(BatchSpanProcessor(exporter))
trace.set_tracer_provider(provider)
tracer = trace.get_tracer("my-app")
with tracer.start_as_current_span("handle-request") as span:
span.set_attribute("http.method", "GET")
span.set_attribute("http.url", "/api/users")
with tracer.start_as_current_span("query-database") as child:
child.set_attribute("db.system", "postgresql")
# your database query here

For manual instrumentation in other languages, see the application guides.

Send at least one request to the instrumented application. For example:

Terminal window
curl http://localhost:8080/health

Then open OpenSearch Dashboards and:

  1. Navigate to Observability → Traces.
  2. Search for your trace by name or filter by time range.
  3. Click a trace to see the span tree, timing, and attributes.

If the trace does not appear within a few seconds, check the APM troubleshooting guide before changing your application code.