The various services in a LangSmith deployment emit telemetry data in the form of logs, metrics, and traces. You may already have telemetry collectors set up in your Kubernetes cluster, or would like to deploy one to monitor your application.This page describes how to configure an OTel Collector to gather telemetry data from LangSmith. Note that all of the concepts discussed below can be translated to other collectors such as Fluentd or FluentBit.
This section is only applicable for Kubernetes deployments.
This is an example for a Sidecar collector to read logs from its own pod, excluding logs from non domain-specific containers. A Sidecar configuration is useful here because we require access to every container’s filesystem. A DaemonSet can also be used.
Metrics can be scraped using the Prometheus endpoints. A single instance Gateway collector can be be used to avoid duplication of queries when fetching metrics. The following config scrapes all of the default named LangSmith services:
Copy
Ask AI
prometheus: config: scrape_configs: - job_name: langsmith-services metrics_path: /metrics scrape_interval: 15s # Only scrape endpoints in the LangSmith namespace kubernetes_sd_configs: - role: endpoints namespaces: names: [<langsmith-namespace>] relabel_configs: # Only scrape services with the name langsmith-.* - source_labels: [__meta_kubernetes_service_name] regex: "langsmith-.*" action: keep # Only scrape ports with the following names - source_labels: [__meta_kubernetes_endpoint_port_name] regex: "(backend|platform|playground|redis-metrics|postgres-metrics|metrics)" action: keep # Promote useful metadata into regular labels - source_labels: [__meta_kubernetes_service_name] target_label: k8s_service - source_labels: [__meta_kubernetes_pod_name] target_label: k8s_pod # Replace the default "host:port" as Prom's instance label - source_labels: [__address__] target_label: instance
This configuration requires ‘get’, ‘list’, and ‘watch’ permissions on pods, services and endpoints in the given namespace.
For traces, you need to enable the OTLP receiver. The following configuration can be used to listen to HTTP traces on port 4318, and GRPC on port 4317:
The following processors are recommended when using the OTel collector:
Batch Processor: Groups the data into batches before sending to exporters.
Memory Limiter: Prevents the collector from using too much memory and crashing. When the soft limit is crossed, the collector stops accepting new data.
Exporters just need to point to an external endpoint of your liking. The following configuration allows you to configure a separate endpoint for logs, metrics and traces: