-
Notifications
You must be signed in to change notification settings - Fork 601
feat: Add sharding for loki.write #4882
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
Changes from all commits
639204d
4181ced
cf85550
307aeb0
601ddec
39dcafa
fce3f82
ef92489
1b17a30
8c47db9
22483b9
b561650
aaebdd5
fbd640f
6e405ca
36fbaab
def54ab
94f680e
b7c1f21
ef40a0a
ea9f263
757dfa0
19d9b79
049f018
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 the 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 endpoints in succession. That means that if one endpoint is bottlenecked, it may impact the rest. | ||||||
|
|
||||||
| Each endpoint has a _queue_ of batches to be sent. The `queue_config` block can be used to customize the behavior of this 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. | ||||||
|
|
||||||
|
|
@@ -129,15 +130,21 @@ When `retry_on_http_429` is enabled, the retry mechanism is governed by the back | |||||
|
|
||||||
| {{< 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. | ||||||
|
thampiotr marked this conversation as resolved.
|
||||||
|
|
||||||
| 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 | | ||||||
|
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
What does it even mean 'all enqueued batches are full'? Shouldn't it say that it's the total size of all the enqueued batches instead?
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. Yeah this was there before and I did not check / alter it. But essentially whenever the capacity is full that means that the queue of batches is full and we cannot enqueue another one so we would block here until we get more capacity
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. This setting is per-shard right? we should clarify this here. |
||||||
| | `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 | | ||||||
| | `min_shards` | `number` | Minimum number of concurrent shards sending samples to the endpoint. | `1` | no | | ||||||
|
|
||||||
| Each endpoint is divided into a number of concurrent _shards_ which are responsible for sending a fraction of batches. The number of shards is controlled with `min_shards` argument. | ||||||
| Each shard has a queue of batches it keeps in memory, controlled with the `capacity` argument. | ||||||
|
thampiotr marked this conversation as resolved.
|
||||||
|
|
||||||
| Queue size is calculated using `batch_size` and `capacity` for each shard. So if `batch_size` is 1MiB and `capacity` is 10MiB each shard would be able to queue up 10 batches. | ||||||
| The maximum amount of memory required for all configured shards can be calculated using `capacity` * `min_shards`. | ||||||
|
|
||||||
| ### `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.
Shouldn't this continue to be experimental?
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.
Yeah we could keep this as experimental. But we would always use this config after this pr.
What would be considered experimental with it would be naming and changing defaults I guess.