Exporting LangSmith telemetry to your observability backend
This section is only applicable for Kubernetes deployments.
Self-Hosted LangSmith instances produce telemetry data in the form of logs, metrics and traces. This section will show you how to access all of that data, and how to export that data to your observability collector or backend.
This section assumes that you have monitoring infrastructure set up already, or you will set up this infrastructure and you want to know how to configure it as well as LangSmith to collect data.
Infrastructure refers to:
- A collector, such as OpenTelemetry, FluentBit or Prometheus
- An observability backend, such as Datadog
If you would like LangSmith to bring up a collector or a full observability stack, check the other pages under the Self-Hosted Observability section.
Logs
All services that are part of the LangSmith self-hosted deployment write their logs to their node's filesystem. This includes Postgres, Redis and Clickhouse if you are running the default in-cluter versions. In order to access these logs, you need to set up your collector to read from said files. Most popular collectors support reading file logs.
For example:
- OpenTelemetry: File Log Receiver
- FluentBit: Tail Input
- Datadog: Kubernetes Log Collection
Metrics
LangSmith Services
The following LangSmith services expose metrics at an endpoint, in the Prometheus metrics format.
- Backend Service:
http://langsmith-backend.<namespace>.svc.cluster.local:1984/metrics
- Platform Backend Service:
http://langsmith-platform-backend.<namespace>.svc.cluster.local:1986/metrics
- Host Backend Service:
http://host-backend.<namespace>.svc.cluster.local:1985/metrics
- Playground Service:
http://langsmith-playground.<namespace>.svc.cluster.local:1988/metrics
It is recommended to use a Prometheus server or OpenTelemetry collector to scrape the endpoint, and export it to the backend of your choice.
The following sections apply for in-cluster databases only. If you are using external databases, you will need to configure exposing and fetching metrics.
Redis
If you are using the in-cluster Redis instance from the Helm chart, LangSmith can expose metrics for you if you upgrade the chart with the following values:
redis:
metrics:
enabled: true
This will run a sidecar container alongside your redis instance which will expose Prometheus metrics at: http://langsmith-<redis_name>.<namespace>.svc.cluster.local:9121/metrics
Postgres
Similarly, to expose Postgres metrics, upgrade the LangSmith Helm chart with the following values:
postgres:
metrics:
enabled: true
This will run a sidecar container, exposing Prometheus metrics at http://langsmith-<postgres_name>.<namespace>.svc.cluster.local:9187/metrics
Clickhouse
The Clickhouse container can expose metrics directly, without the need for a sidecar. To expose the metrics endpoint, run the LangSmith Helm chart with the following values:
clickhouse:
metrics:
enabled: true
You can then scrape metrics at http://langsmith-<clickhouse_name>.<namespace>.svc.cluster.local:9363/metrics
Traces
The LangSmith Backend, LangSmith Platform Backend, LangSmith Queue, and LangSmith Playground services have been instrumented using the OTEL SDK to emit traces adhering to the OpenTelemetry format. Tracing is toggled off by default, and can be enabled by adding the following values to your configuration file, and upgrading your LangSmith helm chart:
config:
tracing:
enabled: true
endpoint: "<your_collector_endpoint>"
useTls: true
This will export traces from all LangSmith backend services to the specified endpoint.