-
Notifications
You must be signed in to change notification settings - Fork 265
docs: add StatsD configuration details for worker container scaling #3261
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -30,8 +30,30 @@ On very high loads, it may become necessary to apply additional settings that in | |||||
| For most environments, we recommend to scale the worker containers by their CPU load as this is a straightforward metric to measure. | ||||||
| A load above 50% for a 2 CPU container is an indicator that the instance is saturated and that the throughput should increase by adding more containers. | ||||||
|
|
||||||
| In addition, the Langfuse worker also publishes queue length metrics via statsd that can be used to scale the worker containers. | ||||||
| In addition, the Langfuse worker also publishes queue length metrics via StatsD (DogStatsD format) that can be used to scale the worker containers. | ||||||
| `langfuse.queue.ingestion.length` is the main metric that we use to make scaling decisions. | ||||||
|
|
||||||
| #### Configuring StatsD | ||||||
|
|
||||||
| Langfuse uses the [`dd-trace`](https://docs.datadoghq.com/tracing/trace_collection/automatic_instrumentation/dd_libraries/nodejs/) package (DataDog's tracing library) which includes a DogStatsD client. The client auto-configures using standard DataDog environment variables: | ||||||
|
|
||||||
| | Environment Variable | Default | Description | | ||||||
| | ----------------------- | ------------- | ------------------------------------------ | | ||||||
| | `DD_AGENT_HOST` | `localhost` | StatsD agent hostname or IP | | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Prompt To Fix With AIThis is a comment left during a code review.
Path: content/self-hosting/configuration/scaling.mdx
Line: 42
Comment:
The description for `DD_AGENT_HOST` says "StatsD agent hostname or IP", but since Langfuse uses DogStatsD format (not vanilla StatsD), this host must point to a **DataDog Agent** running a DogStatsD listener — a plain StatsD server would not understand the DogStatsD wire format and metrics would be silently dropped. Calling it a "StatsD agent" could lead operators to point it at a generic StatsD endpoint and wonder why nothing shows up in DataDog.
```suggestion
| `DD_AGENT_HOST` | `localhost` | DataDog Agent hostname or IP (must run a DogStatsD listener) |
```
How can I resolve this? If you propose a fix, please make it concise. |
||||||
| | `DD_DOGSTATSD_PORT` | `8125` | DogStatsD server port | | ||||||
| | `DD_ENV` | — | Environment tag applied to all metrics | | ||||||
| | `DD_SERVICE` | — | Service name tag applied to all metrics | | ||||||
|
|
||||||
| These variables apply to both the web and worker containers. | ||||||
|
|
||||||
| Langfuse-specific queue metric configuration (worker container only): | ||||||
|
|
||||||
| | Environment Variable | Default | Description | | ||||||
| | ---------------------------------------------- | -------- | -------------------------------------------------------------- | | ||||||
| | `LANGFUSE_QUEUE_METRICS_ENABLED` | `true` | Master toggle for publishing queue metrics via StatsD | | ||||||
| | `LANGFUSE_QUEUE_METRICS_INTERVAL_MS` | `1000` | Poll interval for queue depth metrics (minimum 100ms) | | ||||||
| | `LANGFUSE_QUEUE_METRICS_SAMPLE_RATE` | `0.3` | Probability for recording sharded queue depth metrics (0-1) | | ||||||
|
|
||||||
| The queue metrics can also be published to AWS CloudWatch by setting `ENABLE_AWS_CLOUDWATCH_METRIC_PUBLISHING=true` to configure auto-scalers based on AWS metrics. | ||||||
|
|
||||||
| ### Reducing ClickHouse reads within the ingestion processing | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DD_AGENT_HOSTorDD_DOGSTATSD_PORTwill land on unrelated APM setup content. The DataDog DogStatsD docs (https://docs.datadoghq.com/developers/dogstatsd/) more directly describe the DogStatsD client and its environment variables.Prompt To Fix With AI
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!