GoodMemGoodMem
ReferenceOpenTelemetry

OpenTelemetry configuration

Environment variables, JVM properties, defaults, and precedence for server trace export.

OpenTelemetry configuration

GoodMem reads OTel configuration at startup, with JVM system properties first, environment variables second, and defaults last. Use those properties or variables rather than GoodMem server or Go CLI flags.

For JVM properties, use lowercase names with dots instead of underscores:

Environment variableJVM property
OTEL_SERVICE_NAMEotel.service.name
GOODMEM_OTEL_EXPORT_PROFILEgoodmem.otel.export.profile
GOODMEM_OTEL_REMOTE_PARENTgoodmem.otel.remote.parent

Place JVM properties before -jar:

java -Dotel.service.name=memory-api -jar goodmem-server.jar

Retain the usual database and server configuration alongside these properties. Restart the server after a telemetry configuration change.

Export and identity

Environment variableDefaultMeaning
OTEL_TRACES_EXPORTERnoneotlp enables network export; logging writes spans to local output
OTEL_METRICS_EXPORTERnoneSDK metric exporter; separate from GoodMem Micrometer metrics
OTEL_LOGS_EXPORTERnoneSDK log exporter; separate from GoodMem application logs
OTEL_SDK_DISABLEDfalsetrue disables SDK signal processing and export; context propagation remains available
OTEL_SERVICE_NAMEgoodmem-serverService identity in the backend
OTEL_RESOURCE_ATTRIBUTESServer build supplies service.versionComma-separated resource attributes; explicit values can override the build version
GOODMEM_OTEL_EXPORT_PROFILEneutralneutral, langfuse, or langsmith
GOODMEM_OTEL_REMOTE_PARENTparentparent continues an external trace; link starts a separate trace

Vendor profiles affect exported metadata only; endpoint selection and request execution remain separate.

For OTEL_RESOURCE_ATTRIBUTES, use plain values such as deployment.environment.name=production, without OTLP header encoding.

OTLP transport

Environment variableDefaultMeaning
OTEL_EXPORTER_OTLP_PROTOCOLgrpcgrpc or http/protobuf
OTEL_EXPORTER_OTLP_ENDPOINTSDK local receiver defaultGeneric endpoint; select an explicit destination for deployed servers
OTEL_EXPORTER_OTLP_HEADERSNo headersComma-separated name=value pairs
OTEL_EXPORTER_OTLP_TIMEOUTSDK defaultExport timeout
OTEL_EXPORTER_OTLP_COMPRESSIONnonenone or gzip
OTEL_EXPORTER_OTLP_CERTIFICATEPlatform trust storePEM trust certificate file
OTEL_EXPORTER_OTLP_CLIENT_CERTIFICATEUnsetPEM client certificate file for mTLS
OTEL_EXPORTER_OTLP_CLIENT_KEYUnsetPEM private key file for mTLS

Each transport setting also has a trace-specific form:

OTEL_EXPORTER_OTLP_TRACES_PROTOCOL
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
OTEL_EXPORTER_OTLP_TRACES_HEADERS
OTEL_EXPORTER_OTLP_TRACES_TIMEOUT
OTEL_EXPORTER_OTLP_TRACES_COMPRESSION
OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE
OTEL_EXPORTER_OTLP_TRACES_CLIENT_CERTIFICATE
OTEL_EXPORTER_OTLP_TRACES_CLIENT_KEY

Trace-specific settings take precedence over generic settings. A nonempty trace-specific header map replaces the generic headers.

Endpoint paths

With HTTP/protobuf, the SDK appends /v1/traces to the generic endpoint but uses a trace-specific endpoint exactly as supplied.

FormExample
Generic HTTP endpointOTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4318
Complete trace endpointOTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces
gRPC endpointOTEL_EXPORTER_OTLP_ENDPOINT=http://otel-collector:4317

Use the base receiver URL for a generic HTTP endpoint or a gRPC endpoint. Langfuse requires an explicit http/protobuf setting for this server.

Header values

Use percent encoding for special characters in header values. Keep the header names, commas, and separator equals signs outside that encoding. Use %20 for a space and %2B for a literal plus. The Java SDK decodes a raw plus as a space.

See the Langfuse header recipe for an executable example.

TLS files

Use HTTPS for remote collectors. For mTLS, supply both the client certificate and the private key. For containers, mount those files read-only at paths inside the server filesystem.

Sampling and propagation

Environment variableDefaultMeaning
OTEL_PROPAGATORStracecontextW3C traceparent and tracestate; remote baggage is off
OTEL_TRACES_SAMPLERparentbased_always_onSampler for recorded traces
OTEL_TRACES_SAMPLER_ARGUnsetArgument for the selected sampler

For a transport check, use always_on. For a production ratio, use a configuration such as:

OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1

This configuration samples approximately ten percent of local root traces, while parent retains the caller sampling decision. The link policy instead uses a local decision. Head sampling uses information available at the start of the operation.

See application trace correlation for caller requirements.

Queue and attribute limits

GoodMem honors the standard OTEL_BSP_* and attribute-limit variables from the Java SDK configuration reference. Lower SDK limits can remove fields that backend filters need.

Startup and shutdown

If telemetry initialization fails, GoodMem disables export, emits a sanitized diagnostic, and continues to serve requests. The independent Prometheus endpoint exposes the initialization-failure gauge. Correct rejected configuration before the next restart.

The server drains requests, maintenance tasks, and background work before a short, bounded final export. For planned stops, use an explicit drain before container termination. See Allow time for shutdown for the command, recommended grace period, and deployment checks.