Prerequisites
API Credentials
Create API credentials from the Unomiq Dashboard. The credentials must have thewrite:traces permission.
This will give you an API key (Client ID) and secret (Client Secret).
With unomiq-sdk
The unomiq-sdk Python package handles OAuth2-authenticated OTLP export and unit attribute attachment. It can be used on its own (direct export) or alongside an OTel Collector sidecar.
Configuration
Set the following environment variables for your application:
The SDK uses these credentials internally to acquire and refresh OAuth2 tokens and export traces to the Unomiq Gateway.
Direct Export (No Sidecar)
In this approach,unomiq-sdk handles everything: it creates a TracerProvider, configures an OAuth2-authenticated OTLP exporter, and attaches unit attributes to spans.
UNOMIQ_CLIENT_ID and UNOMIQ_CLIENT_SECRET from the environment, creates an authenticated OTLP exporter, and sets up the global TracerProvider. No additional exporter or provider configuration is needed.
For frameworks like Flask or Django, you can use OpenTelemetry instrumentor libraries after calling Unomiq.init():
With OTel Collector Sidecar
You can also useunomiq-sdk alongside a Collector sidecar. In this case, the sidecar handles OAuth and export, while unomiq-sdk only handles unit attribute attachment.
resolve_unit / resolve_parent_unit. No app_name or resource_attributes are required.
Point your application’s OTLP exporter at the local collector:
Without unomiq-sdk
If you are not using unomiq-sdk, you can send traces by managing the OAuth2 flow and OTLP export yourself. There are two approaches:
- Collector Sidecar — an OTel Collector runs alongside your app, handles OAuth2, and forwards traces to the gateway.
- Direct from Application — your application code manages OAuth2 tokens and sends traces to the gateway.
Configuration
Set the following environment variables:Direct from Application (Python)
In this approach, your application manages OAuth2 tokens and sends authenticated traces directly to the gateway. No sidecar is needed.Step 1: OAuth2 Token Manager
Create a token manager that handles the client credentials flow and automatic refresh. If the token endpoint returns arefresh_token, subsequent renewals use the lighter
refresh_token grant instead of re-sending client credentials:
Step 2: Configure the Tracer
Wire the token manager into the OTLP exporter:Step 3: Use the Tracer
opentelemetry-instrumentation-flask) after calling configure_tracing().
Required Dependencies
OTel Collector Sidecar Configuration
This section applies to both theunomiq-sdk sidecar approach and the without-SDK sidecar approach. In both cases, the collector handles OAuth2 token acquisition and forwards authenticated traces to the gateway.
oauth2clientauthextension from the OpenTelemetry Collector Contrib distribution.
Environment Variables
Set the following environment variables for the collector (not the application):Collector Config
Create anotel-collector-config.yaml:
- The
oauth2clientextension acquires a token using the client credentials grant and automatically refreshes it before expiry. - The
otlphttpexporter references the extension viaauth.authenticator, so every outgoing request includes theAuthorization: Bearer <token>header. - The receiver listens on standard OTLP ports (4317 for gRPC, 4318 for HTTP) without requiring any authentication from your application.
Running the Collector
Use the contrib distribution of the collector, which includes theoauth2clientauthextension. The core distribution does not include it.
Docker Compose example:
Configuring Your Application
Point your application’s OTLP exporter at the local collector. No authentication configuration is needed in the application itself. Python (automatic instrumentation):OTEL_EXPORTER_OTLP_ENDPOINT environment variable to http://localhost:4318 (or the collector’s hostname in Docker/Kubernetes).
Choosing an Approach
Monitoring Sent Traces
Once your traces are flowing to the gateway, you can monitor them in two ways:- API — Use the Get Live Traces endpoint to programmatically retrieve and inspect incoming traces in real time.
- Dashboard — View and explore traces visually from the Unomiq Dashboard.
Troubleshooting
Common Issues
401 Unauthorized from the gateway- Verify that your client ID and secret are correct (
UNOMIQ_CLIENT_ID/UNOMIQ_CLIENT_SECRET). - Check that the scopes match what the gateway expects (
write:traces). - Ensure the token endpoint is reachable from your environment.
- Confirm the OTLP endpoint is set to the correct gateway URL.
- For the sidecar approach, check collector logs for export errors.
- For direct export, enable debug logging:
logging.getLogger('opentelemetry').setLevel(logging.DEBUG).
- The sidecar collector and the
unomiq-sdk/ Python token manager all refresh tokens automatically before expiry. Check logs for errors from the token endpoint. - Ensure your OAuth2 client has not been revoked or rate-limited.
Viewing Collector Logs (Sidecar Approach)
Add thedebug exporter to your collector pipeline for verbose output: