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

The following data can be uploaded to APM:
  • 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:

Note

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.
  1. 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

  2. Metrics

    Add the following APM data upload endpoint to upload metrics to Application Performance Monitoring:

    https://<dataUploadEndpoint>/20200101/opentelemetry/v1/metrics

    Metrics are always authenticated with private data key.

  3. 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”

Note

  • Some OpenTelemetry clients automatically add the /v1/traces or /v1/metrics suffix 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 the Content-Type header, but this is usually done automatically by the OTEL library/collector.
  • Span links are not supported.

Examples

Node.js Example

Here's a sample of the OpenTelemetry code for Node.js. See the changes for the APM data upload endpoint in 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

Here's a sample of the OpenTelemetry code for Java agent. See the changes for the APM data upload endpoint in 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/protobuf

OTEL 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]