LangSmith
Export GoodMem server traces to LangSmith with explicit parent policy and typed metadata.
LangSmith
The langsmith export profile adds run types and selected metadata to GoodMem traces, with numeric, boolean, and array values intact.
You need a LangSmith API key and access to the GoodMem server configuration.
For collector fan-out, follow Export traces from GoodMem with the neutral profile.
Select the parent policy
LangSmith needs every ancestor span in the same project to display a continued trace, even when a collector sits between the services. It can accept an upload but omit the trace if an ancestor is absent.
| Caller export | GoodMem policy | Result |
|---|---|---|
| Caller ancestors reach the same LangSmith project | parent | One continued trace |
| Caller ancestors do not reach that project | Explicit link | Separate GoodMem trace with a caller link |
| Request contains no remote parent | Either policy | GoodMem starts a local trace |
The default remains parent for all export profiles.
For caller setup, see Connect the caller trace.
Configure the endpoint
This example selects link. Set the policy from the table above in the GoodMem server environment:
OTEL_TRACES_EXPORTER=otlp
OTEL_METRICS_EXPORTER=none
OTEL_LOGS_EXPORTER=none
OTEL_SERVICE_NAME=goodmem-server
OTEL_EXPORTER_OTLP_TRACES_PROTOCOL=http/protobuf
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT=https://api.smith.langchain.com/otel/v1/traces
GOODMEM_OTEL_EXPORT_PROFILE=langsmith
GOODMEM_OTEL_REMOTE_PARENT=linkThe example uses the US endpoint. For EU projects, use https://eu.api.smith.langchain.com/otel/v1/traces.
For other regions or self-hosted deployments, use the endpoint from the LangSmith OTel configuration.
Prepare the header file
See the installation directory for the location of .env.
In the installation's private .env file, replace <key> with your LangSmith API key:
OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-api-key=<key>For a project other than default, append ,Langsmith-Project=<name> to that value.
Encode spaces in the project name as %20 and literal plus signs as %2B.
For example:
OTEL_EXPORTER_OTLP_TRACES_HEADERS=x-api-key=<key>,Langsmith-Project=my%20projectKeep .env outside version control; the header value contains credentials.
Apply the configuration
Restart the installation:
goodmem system stop
goodmem system startFor a direct JVM launch, export the same variables before the server starts.
Verify the runs
- Send the verification request.
- Find the request in the intended LangSmith project.
- Match its
request_idmetadata with the responsegoodmem-request-idheader. - If you have a populated space, run one retrieval.
- Inspect the run types and child parentage.
| GoodMem operation | LangSmith run type |
|---|---|
| Retrieval | retriever |
| Embedding | embedding |
| Typed LLM generation | llm |
| Rerank, proxy, or generic operation | chain |
Proxy and rerank spans keep their operation types even when they contain a model name.
Request runs use the RPC or MCP tool name, including when nested under a caller's run.
Child operations keep their own names, such as gen_ai.chat; they are not renamed after the request.
For empty input and output panels, see the trace data controls.
TEI response samples are also retained in provider_response_samples metadata, with at most eight
samples and a 2,048-byte array. Nanosecond receipt timestamps are decimal strings. Projection
omissions use provider_response_samples_dropped, independently of recorder and SDK drops.
These are diagnostic samples, not a native event timeline. llama.cpp, Ollama, and vLLM optional generation
measurements appear as llama_cpp_*, ollama_*, and vllm_* metadata; they do not replace native latency or pricing.
Interpret usage and cost
Cohere rerank billing quantities appear as cohere_search_units in observation/run metadata,
backed by goodmem.rerank.cohere.search_units. These preserve reported billing units independently
of token counts; they do not supply an automatically calculated price.
The profile preserves provider-reported gen_ai.usage.input_tokens for supported embedding and rerank providers.
LangSmith maps this attribute to usage metadata.
Reported LLM totals use gen_ai.usage.total_tokens in every profile; reasoning counts additionally
map to gen_ai.usage.details.reasoning_tokens, and the provider maps through gen_ai.system.
Cached input counts map to gen_ai.usage.cache_read_input_tokens, the underscore spelling verified
to populate native cache_read usage and discounted pricing in controlled backend checks.
They also remain visible as llm_cached_input_tokens metadata and are a subset of input tokens. See the
local-provider mapping table.
Absent usage stays unknown, while an explicit zero remains reported zero.
For embedding and rerank runs, backend readback can retain counts in outputs.usage_metadata
while top-level token totals remain zero. Inspect the nested usage and the original exported
attributes; those top-level zeros do not establish zero consumption.
The profile explicitly sets ls_model_name in its JSON metadata from gen_ai.response.model,
falling back to gen_ai.request.model when the returned model is absent. LangSmith uses
ls_model_name for price matching; setting only invocation_params.model does not establish the
pricing model. Controlled checks with synthetic gpt-4o-mini usage verified discounted cache-read
pricing for this mapping. These checks do not establish pricing for other model catalogs,
actual provider invoices, or automatic embedding/rerank pricing.
LangSmith's cost tracking documentation limits automatic token-based pricing to LLM runs; other run types require explicitly supplied costs.
Embedding and rerank operations retain embedding and chain run types, respectively.
Exporting their usage therefore does not promise automatic cost calculation. GoodMem does not supply estimated prices.
Query metadata
LangSmith stores the profile's selected metadata in extra.metadata, with numeric, boolean, and array values intact.
Each operation supplies its own metadata.
For a scalar metadata filter, use:
has(metadata, '{"hnsw_ef_search":80,"postprocess_fallback":true}')For exact membership in the retained space IDs, use the generated space tag:
has(tags, "goodmem.space:11111111-2222-4333-8444-555555555555")Replace the sample UUID with the space ID. The generated mappings list the fields that the profile exports when the operation supplies a value.
Interpret errors and retries
Use failure_category and failure_origin for provider failure filters.
Diagnose missing runs
Check the project, endpoint, and headers first. If uploads succeed but no request appears, check the parent policy before the sampler. See Troubleshoot tracing for checks at each export stage.