-
Notifications
You must be signed in to change notification settings - Fork 472
loki: implement queue_config for loki.write #4788
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 all commits
6ceb2f6
9e0f275
c26d5ed
1c3c113
84f0ec6
e5486d9
73ed0ad
0f69b44
839fef9
8266b43
567364f
07a054f
1693490
db85a5b
5c43189
921ab85
bfa2a35
c06c69a
e527a60
a12fbdf
84ef118
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 | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,7 +46,7 @@ You can use the following blocks with `loki.write`: | |||||
| | `endpoint` > [`basic_auth`][basic_auth] | Configure `basic_auth` for authenticating to the endpoint. | no | | ||||||
| | `endpoint` > [`oauth2`][oauth2] | Configure OAuth 2.0 for authenticating to the endpoint. | no | | ||||||
| | `endpoint` > `oauth2` > [`tls_config`][tls_config] | Configure TLS settings for connecting to the endpoint. | no | | ||||||
| | `endpoint` > [`queue_config`][queue_config] | When WAL is enabled, configures the queue client. | no | | ||||||
| | `endpoint` > [`queue_config`][queue_config] | Configure the queue used for endpoint. | no | | ||||||
| | `endpoint` > [`tls_config`][tls_config] | Configure TLS settings for connecting to the endpoint. | no | | ||||||
| | [`wal`][wal] | Write-ahead log configuration. | no | | ||||||
|
|
||||||
|
|
@@ -104,8 +104,9 @@ The following arguments are supported: | |||||
| If no `tenant_id` is provided, the component assumes that the Loki instance at `endpoint` is running in single-tenant mode and no X-Scope-OrgID header is sent. | ||||||
|
|
||||||
| When multiple `endpoint` blocks are provided, the `loki.write` component creates a client for each. | ||||||
| Received log entries are fanned-out to these clients in succession. | ||||||
| That means that if one client is bottlenecked, it may impact the rest. | ||||||
| Received log entries are fanned-out to these clients in succession. That means that if one client is bottlenecked, it may impact the rest. | ||||||
| Each endpoint has a _queue_ which is used to queue them for sending. The `queue_config` block can be used to customize the behavior of the queue. | ||||||
|
|
||||||
|
|
||||||
| Endpoints can be named for easier identification in debug metrics by using the `name` argument. If the `name` argument isn't provided, a name is generated based on a hash of the endpoint settings. | ||||||
|
|
||||||
|
|
@@ -127,17 +128,18 @@ When `retry_on_http_429` is enabled, the retry mechanism is governed by the back | |||||
|
|
||||||
| ### `queue_config` | ||||||
|
|
||||||
| {{< docs/shared lookup="stability/experimental_feature.md" source="alloy" version="<ALLOY_VERSION>" >}} | ||||||
|
|
||||||
| The optional `queue_config` block configures, when WAL is enabled, how the underlying client queues batches of logs sent to Loki. | ||||||
| Refer to [Write-Ahead block](#wal) for more information. | ||||||
| The optional `queue_config` block configures, how the endpoint queues batches of logs sent to Loki. | ||||||
|
|
||||||
| The following arguments are supported: | ||||||
|
|
||||||
| | Name | Type | Description | Default | Required | | ||||||
| | --------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- | -------- | | ||||||
| | `capacity` | `string` | Controls the size of the underlying send queue buffer. This setting should be considered a worst-case scenario of memory consumption, in which all enqueued batches are full. | `10MiB` | no | | ||||||
| | `drain_timeout` | `duration` | Configures the maximum time the client can take to drain the send queue upon shutdown. During that time, it enqueues pending batches and drains the send queue sending each. | `"1m"` | no | | ||||||
|
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
|
||||||
| | `min_shards` | `number` | Minimum amount of concurrent shards sending samples to the endpoint. | `1` | no | | ||||||
|
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
Maybe we should also stop using term 'shard' and use 'worker'?
Contributor
Author
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. I used the same wording that we do in prometheus.remote_write |
||||||
|
|
||||||
| Each queue manages a number of concurrent _shards_ which is responsible for sending a fraction of batches to their respective endpoints. | ||||||
|
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
Contributor
Author
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. Same as this |
||||||
| Each shard has a buffer of batches it keeps in memory, controlled with the `capacity` argument. | ||||||
|
Comment on lines
+141
to
+142
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.
so what is the queue? is it the thing that manages the shards that have buffers? or is it the buffer inside of each shard and there is some kind of manager above them? We need to document it in a way that will make the answers to above questions clear :) This doc already had some of these issues, but I think we need to clean this up and make it easier to understand with this PR.
Contributor
Author
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. Ah yeah this is wrong, each shard has it's own queue |
||||||
|
|
||||||
| ### `tls_config` | ||||||
|
|
||||||
|
|
||||||
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.
We introduce the word 'client' here, while it's an unnecessary implementation detail I think - we can just talk about 'endpoints' and queues which each has maybe a 'worker' that sends the logs to their destination.