Configure OpenTelemetry Data Sources
Here's information on configuring the OpenTelemetry (OTEL) data sources (such as instrumentation libraries and OpenTelemetry Collector) to upload data to Application Performance Monitoring (APM).
Supported Data
- Traces
- Metrics
- Log events
Use the OTEL-Compatible Endpoint
To use OpenTelemetry to upload data to Application Performance Monitoring, specify the following as the OTEL data upload endpoint:
Depending on the data source type, the OTEL data upload endpoint can be specified in a configuration file, environment variable, code or even the user interface.
-
Traces
Set the APM data upload endpoint to upload traces to Application Performance Monitoring.
Traces can be authenticated with a public or private data key.
- For traces authenticated with public data key, add the
following:
https://<dataUploadEndpoint>/20200101/opentelemetry/public/v1/traces - For traces authenticated with private data key, add the
following:
https://<dataUploadEndpoint>/20200101/opentelemetry/private/v1/traces
For example, if the traces are authenticated with public data key, the APM data upload endpoint looks like the following:
https://aaabbbb.example.us-phoenix-1.oci.oraclecloud.com/20200101/opentelemetry/public/v1/traces - For traces authenticated with public data key, add the
following:
-
Metrics
Add the following APM data upload endpoint to upload metrics to Application Performance Monitoring:
https://<dataUploadEndpoint>/20200101/opentelemetry/v1/metricsMetrics are always authenticated with private data key.
-
Log Events
Add the following APM data upload endpoint to upload metrics to Application Performance Monitoring:
https://<dataUploadEndpoint>/20200101/opentelemetry/v1/
The above APM data upload endpoints provide the OpenTelemetry standard
to report the data. These calls do not accept any query parameters. Data key are
supplied as a header like the following: “Authorization”: “dataKey
aaaabbbbccc”
- Some OpenTelemetry clients automatically add the
/v1/tracesor/v1/metricssuffix while others don't. If the suffix is not added, it must be specified as part of the URL in the configuration. APM supports JSON and Protocol Buffers (protobuf) encoded data. They should be explicitly specified in theContent-Typeheader, but this is usually done automatically by the OTEL library/collector. - Span links are not supported.
Examples
Node.js Example
bold:const opentelemetry = require("@opentelemetry/sdk-node");
const {
getNodeAutoInstrumentations,
} = require("@opentelemetry/auto-instrumentations-node");
const {
OTLPTraceExporter,
} = require("@opentelemetry/exporter-trace-otlp-http");
const sdk = new opentelemetry.NodeSDK({
traceExporter: new OTLPTraceExporter({
url: "https://aaabbbb.example.us-phoenix-1.oci.oraclecloud.com/20200101/opentelemetry/private/v1/traces",
headers: {"Authorization": "dataKey AAAAABBBBBCCCC"},
}),
instrumentations: [getNodeAutoInstrumentations()]
});
sdk.start()
(base) [ssirajud@ssirajud node_with_opentelemetry]$Java Agent Example
bold:export OTEL_TRACES_EXPORTER=otlp
export OTEL_SERVICE_NAME=my-service
export OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
export OTEL_EXPORTER_OTLP_TRACES_HEADERS="authorization=dataKey 1111aaaabbbccc"
export OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://aaabbbb.example.us-phoenix-1.oci.oraclecloud.com/20200101/opentelemetry/private/v1/traces/
export OTEL_METRICS_EXPORTER=otlp
export OTEL_EXPORTER_OTLP_METRICS_ENDPOINT=https://aaabbbb.example.us-phoenix-1.oci.oraclecloud.com/20200101/opentelemetry/v1/metrics
export OTEL_EXPORTER_OTLP_METRICS_HEADERS="authorization=dataKey 1111aaaabbbccc"
export OTEL_EXPORTER_OTLP_METRICS_PROTOCOL=http/protobufOTEL Collector Example
Here's a sample of the OpenTelemetry collector. See the changes for the APM data
upload endpoint in bold:
receivers:
otlp:
protocols:
http:
exporters:
logging:
verbosity: detailed
otlphttp:
endpoint: https://aaaaXXXX.apm-agt.us-ashburn-1.oci.oraclecloud.com/20200101/opentelemetry/private/v1/traces/
headers:
Authorization: "dataKey XXX"
processors:
batch:
service:
pipelines:
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]