GoodMemGoodMem
How-To Guides

Export traces from GoodMem

Connect a GoodMem server to an OTLP collector or a trace backend.

Export traces from GoodMem

Connect an existing GoodMem server to your collector. An authenticated request then checks the export path. You need access to the server configuration, an OTLP receiver, and an API key with permission to list spaces.

Select the destination

DestinationProfileProtocol
Your collector, with one or more destinationsneutralMatch the collector receiver
Direct Jaeger or TemponeutralMatch the backend OTLP receiver
Direct Langfuselangfusehttp/protobuf
Direct LangSmithlangsmithhttp/protobuf

Keep GOODMEM_OTEL_REMOTE_PARENT=parent unless the LangSmith guide says otherwise.

For collector fan-out, select neutral on GoodMem. Apply destination-specific transforms in separate collector pipelines. A vendor profile adds its metadata before every destination, while the parent policy applies once at GoodMem ingress.

For direct SaaS export, follow the Langfuse or LangSmith guide. The steps below use your collector.

Configure the collector receiver

For an isolated verification environment, use this collector configuration:

receivers:
  otlp:
    protocols:
      http:
        endpoint: 0.0.0.0:4318

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    traces:
      receivers: [otlp]
      exporters: [debug]

This receiver is for verification only; production requires TLS, authentication, and a destination exporter.

Configure GoodMem

Set these variables in the server environment:

OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=none
OTEL_LOGS_EXPORTER=none
OTEL_SERVICE_NAME=goodmem-server
OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=development
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=http://otel-collector:4318/v1/traces
OTEL_TRACES_SAMPLER=always_on
GOODMEM_OTEL_EXPORT_PROFILE=neutral
GOODMEM_OTEL_REMOTE_PARENT=parent

Replace otel-collector with an address that the server can reach. Inside a container, localhost identifies that container. For a collector on the same Compose network, use its service name. For a collector on the host, use the host gateway address for your container runtime.

The example already includes the /v1/traces suffix that the trace-specific endpoint requires. For a remote receiver, use HTTPS and its required authentication headers. See OTLP transport settings.

Apply the configuration

Installer-managed deployments

  1. Find the installation profile with goodmem system info.
  2. Open its directory under ~/.goodmem/installs/local-docker/<profile-name>/.
  3. Add the variables to its private .env file.
  4. Restart the installation:
goodmem system stop
goodmem system start

Direct JVM or IDE launch

Set the variables in the Java process environment or the IDE server run configuration. Restart the Java process after the change.

Alternatively, use JVM properties before -jar:

java \
  -Dotel.traces.exporter=otlp \
  -Dotel.exporter.otlp.traces.protocol=http/protobuf \
  -Dotel.exporter.otlp.traces.endpoint=http://localhost:4318/v1/traces \
  -jar goodmem-server.jar

Retain the usual server configuration and JVM options. This example uses a collector on the same host as the Java process.

Kubernetes deployment notes

Set the same variables in the pod environment, with credentials from a Secret. Use terminationGracePeriodSeconds: 30 as shown below.

Allow time for shutdown

The server stop grace period is 30 seconds. Before a planned stop, request a server drain with the CLI:

goodmem system drain --wait

Stop the container only after the command reports Quiesced: true.

For Compose or Kubernetes, use these settings:

# Compose server service
services:
  server:
    stop_grace_period: 30s
# Kubernetes pod specification
spec:
  terminationGracePeriodSeconds: 30

Test the drain and stop sequence under representative load before production use.

Verify delivery

  1. Set GOODMEM_URL to the REST base URL.
  2. Supply GOODMEM_API_KEY through your private environment.
  3. Send one authenticated request:
curl --fail-with-body --silent --show-error \
  --dump-header /tmp/goodmem-trace-check.headers \
  -H "x-api-key: $GOODMEM_API_KEY" \
  "$GOODMEM_URL/v1/spaces?maxResults=1"

Use an API key with permission to list spaces.

  1. Find the request in the collector debug output under service.name=goodmem-server.
  2. Match its goodmem.request.id with the response goodmem-request-id header.
  3. If the collector forwards traces to a backend, find that span's trace ID there.

With the debug-only collector example, verification ends at collector receipt. A matching backend trace confirms delivery through the destination exporter as well. If a stage fails, use Troubleshoot tracing to locate the failure.

Set the production sampling policy

After verification, replace always_on with your production sampler. For example:

OTEL_TRACES_SAMPLER=parentbased_traceidratio
OTEL_TRACES_SAMPLER_ARG=0.1

Restart the installation or Java process after the change.

Connect the caller trace

Configure the caller transport to inject W3C traceparent and tracestate. The GoodMem client SDKs rely on caller transport instrumentation or explicit context injection for this step.

TransportContext source
REST or HTTP MCPHTTP client instrumentation or explicit headers
Network gRPCgRPC client instrumentation or explicit metadata
Stdio MCPNo HTTP header channel

To retain one trace, use GOODMEM_OTEL_REMOTE_PARENT=parent. Export the caller spans to the same destination. Verify a shared trace ID and the expected parent span ID at GoodMem ingress.