OpenTelemetry HTTP protocol

Registers the http and https OTLP protocols with Piko's OpenTelemetry driver, providing trace and metric exporters that talk to any OTLP collector over HTTP/protobuf.

Overview

This is a blank-import package. The entire integration is one import with no glue code. Importing it runs an init() that calls driver_handlers.RegisterOtlpProtocol twice, once for http, once for https. Either protocol becomes selectable from the OTLP configuration consumed by logger_otel_sdk. There is no constructor, no Config struct, and no value returned. The package wraps the upstream OTLP/HTTP trace and metric exporters and appends the standard URL paths (/v1/traces, /v1/metrics) for you.

The registered protocol supplies trace and metric exporters only. There is no log exporter. The http and https names share one factory pair, so selecting TLS is a configuration choice, not a separate registration.

HTTP with protobuf bodies routes through proxies and CDNs that do not pass gRPC. Endpoint, TLS, and headers come from the OTLP setup config. The package consumes them instead of owning them. The Endpoint value may be a full URL or a host:port pair. The package adds http:// or https:// based on the configured protocol if no scheme is present.

Pair this with logger_otel_sdk, which owns the provider construction, batching, sampling, and shutdown closers. The HTTP package stays small and only contributes the exporter factories. Point either at an OpenTelemetry Collector or a SaaS backend (Honeycomb, Grafana Cloud, Datadog) that accepts OTLP/HTTP.

Requirements

  • A reachable OTLP/HTTP endpoint. The OpenTelemetry Collector accepts OTLP/HTTP on :4318 by wire convention.
  • The logger_otel_sdk package imported as well. It calls GetOtlpProtocol("http") to look up this registration.

The protocol lookup happens at runtime during OTLP setup, not at import time. Import order between logger_integration_otel_http and logger_otel_sdk does not matter. Select protocol: http without importing this integration and setup returns a clear unsupported OTLP protocol error. It does not fail silently.

Configuration

There is no Go-level configuration. The blank import is the registration.

import (
    _ "piko.sh/piko/wdk/logger/logger_integration_otel_http"
    _ "piko.sh/piko/wdk/logger/logger_otel_sdk"
)

The import alone exports nothing. OTLP export stays off until you enable it. Set the protocol, endpoint, and enabled flag through your Piko configuration. The keys live under otlp.

otlp:
  enabled: true
  protocol: http
  endpoint: localhost:4318
  headers:
    x-api-key: your-key
  tls:
    insecure: false

The same keys map to environment variables: PIKO_OTLP_ENABLED, PIKO_OTLP_PROTOCOL, PIKO_OTLP_ENDPOINT, PIKO_OTLP_HEADERS, and PIKO_OTLP_TLS_INSECURE.

Two defaults need attention.

  • Endpoint. The default is localhost:4317, the gRPC port. When you select http or https, set endpoint to the collector's HTTP port, usually 4318.
  • TLS insecure. otlp.tls.insecure defaults to true, which disables certificate verification. Set it to false for an https endpoint with a real certificate.

Bootstrap

The blank import is the bootstrap. Once imported and enabled, the registered factory builds the exporters during OTLP setup. No further wiring applies.

See also

Sibling OTEL integrations:

Other logger integrations:

  • Sentry, error reporting with OTEL trace correlation.
  • File, file-based log persistence.
  • Prometheus, Prometheus scrape endpoint for metrics.

Framework docs:

External: