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 and export that data to an observability collector or backend.
This section assumes that you have monitoring infrastructure set up already, or you will set up this infrastructure and want to know how to configure LangSmith to collect data from it.
Infrastructure refers to:
- Collectors, such as OpenTelemetry, FluentBit or Prometheus.
- Observability backends, such as Datadog or the Grafana ecosystem.
Logs: OTel Example
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 in-cluster versions. In order to access these logs, you need to set up your collector to read from those files. Most popular collectors support reading logs from filesystems.
Example file system integrations:
- OpenTelemetry: File Log Receiver
- FluentBit: Tail Input
- Datadog: Kubernetes Log Collection
Metrics: OTel Example
LangSmith Services
The following LangSmith services expose metrics at an endpoint, in the Prometheus metrics format.
- Backend:
http://<backend_service_name>.<namespace>.svc.cluster.local:1984/metrics
- Platform Backend:
http://<platform_backend_service_name>.<namespace>.svc.cluster.local:1986/metrics
- Host Backend:
http://<host_backend_service_name>.<namespace>.svc.cluster.local:1985/metrics
- Playground:
http://<playground_service_name>.<namespace>.svc.cluster.local:1988/metrics
You can use a Prometheus or OpenTelemetry collector to scrape the endpoints, and export metrics 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.
Postgres + Redis
If you are using in-cluster Postgres/Redis instances, you can use a Prometheus exporter to expose metrics from your instance. You can deploy your own, or if you would like, you can use the LangSmith Observability Helm Chart to deploy an exporter for you.
Clickhouse
The in-cluster Clickhouse is configured to expose metrics without the need for an exporter.
You can use your collector to scrape metrics at http://langsmith-<clickhouse_name>.<namespace>.svc.cluster.local:9363/metrics
Traces: OTel Example
The LangSmith Backend, Platform Backend, Playground and LangSmith Queue deployments 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
and customized with the following in your values.yaml
file:
config:
tracing:
enabled: true
endpoint: "<your_collector_endpoint>"
useTls: true # Or false
env: "ls_self_hosted" # This value will be set as an "env" attribute in your spans
exporter: "http" # must be either http or grpc
This will export traces from all LangSmith backend services to the specified endpoint.