# OpenTelemetry

If your codebase is already instrumented with OpenTelemetry, you can start sending your traces, metrics and logs to Baselime today.

# Configuration

# Endpoint

  • HTTP: otel.baselime.io/v1/
  • gRPC: otel-ingest.baselime.io:4317

# Headers

x-api-key: <BASELIME_API_KEY>
x-baselime-dataset: <YOUR_DATASET> # Optional, defaults to "otel"

# Baselime OpenTelemetry for Platforms

OpenTelemetry for AWS Lambda
../aws/aws-lambda/traces/
OpenTelemetry for Cloudflare Workers
../cloudflare/traces/


# Baselime OpenTelemetry Distros

Node.js
../../languages/node.js/
Next.js
../../languages/next.js/
Python
../../languages/python/
Go
../../languages/go/


# AWS PrivateLink

Baselime supports AWS PrivateLink for OpenTelemetry.

AWS PrivateLink for OpenTelemetry
private-link/


# Manual instrumentation

This section covers basic configuration of traces and metrics exporter. For more detailed examples, refer to the OpenTelemetry Distros section for your language or platform.

index.js
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metric-otlp-http';

const traceExporter = new OTLPTraceExporter({
    url: "otel.baselime.cc:4317",
    headers: {
        "x-api-key": BASELIME_API_KEY,
        "x-baselime-dataset": YOUR_DATASET,
    },
    timeoutMillis: 1000,
});

const metricExporter = new OTLPMetricExporter({
    url: "otel.baselime.cc:4317",
    headers: {
        "x-api-key": BASELIME_API_KEY,
        "x-baselime-dataset": YOUR_DATASET,
    },
    timeoutMillis: 1000,
});

OpenTelemetry documentation for Javascript

main.go
package main

import (
	"context"
	"go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc"
	"go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc"
)

var metricExporter, _ = otlpmetricgrpc.New(
	context.TODO(),
	otlpmetricgrpc.WithEndpoint("otel-ingest.baselime.cc:4317"),
	otlpmetricgrpc.WithHeaders(map[string]string{
		"x-api-key": BASELIME_API_KEY,
		"x-baselime-dataset": YOUR_DATASET,
	}),
)

var traceExporter, _ = otlptracegrpc.New(
	context.TODO(),
	otlptracegrpc.WithEndpoint("otel-ingest.baselime.cc:4317"),
	otlptracegrpc.WithHeaders(map[string]string{
        "x-api-key": BASELIME_API_KEY,
        "x-baselime-dataset": YOUR_DATASET,
    }),
)

OpenTelemetry documentation for Go

main.py
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import OTLPSpanExporter
from opentelemetry.exporter.otlp.proto.grpc.metrics_exporter import OTLPMetricsExporter

span_exporter = OTLPSpanExporter(
    endpoint="otel-ingest.baselime.cc:4317",
    headers={
        "x-api-key": BASELIME_API_KEY,
        "x-baselime-dataset": YOUR_DATASET,
    },
)

metric_exporter = OTLPMetricsExporter(
    endpoint="otel-ingest.baselime.cc:4317",
    headers={
        "x-api-key": BASELIME_API_KEY,
        "x-baselime-dataset": YOUR_DATASET,
    },
)

OpenTelemetry documentation for Python

Main.java
import io.opentelemetry.exporter.otlp.metrics.OtlpGrpcMetricExporter;
import io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter;

OtlpGrpcSpanExporter spanExporter = OtlpGrpcSpanExporter.builder()
    .setEndpoint("otel-ingest.baselime.cc:4317")
    .addHeader("x-api-key", BASELIME_API_KEY)
    .addHeader("x-baselime-dataset", YOUR_DATASET)
    .build();
    
OtlpGrpcMetricExporter metricExporter = OtlpGrpcMetricExporter.builder()
    .setEndpoint("otel-ingest.baselime.cc:4317")
    .addHeader("x-api-key", BASELIME_API_KEY)
    .addHeader("x-baselime-dataset", YOUR_DATASET)
    .build();

OpenTelemetry documentation for Java

Consult the OTEL documentation to find support for traces, metrics and logs for other languages and platforms.