Skip to main content

OpenTelemetry quickstarts

Use this guide when your service does not run on Node.js. Aient accepts standard OTLP/HTTP, so you can use the OpenTelemetry SDK or auto-instrumentation for your runtime. Every example sends traces to Aient with a bearer-authenticated publishable key and the release metadata Aient uses to group a deployment and correlate source maps.

Set shared deployment values

Create an Aient environment publishable key, then set these values in your deployment environment. Do not commit the key or a real token to source control.
OTEL_EXPORTER_OTLP_ENDPOINT is a base URL. Standard OTLP SDKs append /v1/traces for traces. OTEL_EXPORTER_OTLP_HEADERS makes each export request send Authorization: Bearer <publishableKey>. Use the immutable version that identifies the deployed build, such as a release tag or build number, for service.version. Set deployment.commit_sha to the exact revision running in production, not the revision currently checked out by a CI job after deployment. The same service.name and commit SHA must be used when you upload source maps.
Aient accepts OTLP/HTTP. Do not use an OTLP/gRPC-only endpoint. If your SDK ignores the shared protocol variables, configure its HTTP/protobuf exporter explicitly, as shown below.

Python: Django, FastAPI, or Flask

Install the HTTP exporter and the instrumentation package for your framework.
With the shared deployment values set, launch through the OpenTelemetry wrapper:
For FastAPI or Flask, run the normal ASGI or WSGI command through opentelemetry-instrument. The wrapper instruments installed framework packages before your application loads.

Java: Spring Boot and JVM services

Download the OpenTelemetry Java agent as part of your build or container image, then run the service with it. The shared deployment values configure the endpoint, bearer header, service, version, commit, ref, and environment.
The Java agent auto-instruments supported frameworks, HTTP clients, JDBC, and more. Keep OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf: the public Aient ingest endpoint is OTLP/HTTP.

.NET: ASP.NET Core

Install the SDK, OTLP exporter, and ASP.NET Core instrumentation.
Add OpenTelemetry before building the application. The shared deployment values provide the resource attributes and bearer-authenticated HTTP exporter configuration.

Ruby: Rails

Add the OpenTelemetry packages to your Gemfile.
Then initialise tracing before Rails loads the application. The Ruby OTLP exporter reads the shared endpoint, bearer header, and resource environment variables.

PHP: Laravel or Symfony

Install the auto-instrumentation package for the framework.
Add these PHP-specific variables alongside the shared deployment values:
PHP loads the exporter and instrumentation from the environment. Keep the shared OTEL_EXPORTER_OTLP_HEADERS value intact: it is the bearer token header.

Go: net/http, Gin, or other HTTP services

Install the SDK, HTTP exporter, and the instrumentation package for your router.
Configure the HTTP exporter and resource before creating your router. This example uses Gin; keep the same resource fields for other routers.
The snippet requires the normal Go imports for context, log, os, go.opentelemetry.io/otel, go.opentelemetry.io/otel/attribute, go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp, go.opentelemetry.io/otel/sdk/resource, go.opentelemetry.io/otel/sdk/trace, and your Semantic Conventions package. Add your router middleware after registering the provider.

Elixir: Phoenix

Add OpenTelemetry and Phoenix instrumentation to mix.exs, then configure the OTLP exporter in runtime.exs before the application starts.
Use :opentelemetry_phoenix to instrument Phoenix after the exporter is configured.

Verify the connection

Deploy the instrumented service, make one request that reaches the application, then check Aient’s telemetry view for the service name. The trace should show the service.version, deployed commit SHA, branch, and environment you set above. If no traces arrive, first confirm that the process received AIENT_PUBLISHABLE_KEY and that the exported header is exactly Authorization: Bearer <publishableKey>. Then confirm the exporter uses https://ingest.aient.ai over OTLP/HTTP, not gRPC. See OpenTelemetry endpoints for the endpoint contract.