Skip to content

Commit

Permalink
Merge branch 'main' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
JStickler authored Apr 17, 2024
2 parents 1845c0c + 41246a0 commit 04e6968
Show file tree
Hide file tree
Showing 93 changed files with 2,249 additions and 953 deletions.
17 changes: 0 additions & 17 deletions .drone/drone.jsonnet
Original file line number Diff line number Diff line change
Expand Up @@ -450,23 +450,6 @@ local build_image_tag = '0.33.1';
},
],
},
pipeline('mixins') {
workspace: {
base: '/src',
path: 'loki',
},
steps: [
make('lint-jsonnet', container=false) {
// Docker image defined at https://github.com/grafana/jsonnet-libs/tree/master/build
image: 'grafana/jsonnet-build:c8b75df',
depends_on: ['clone'],
},
make('loki-mixin-check', container=false) {
depends_on: ['clone'],
when: onPRs + onPath('production/loki-mixin/**'),
},
],
},
pipeline('documentation-checks') {
workspace: {
base: '/src',
Expand Down
34 changes: 1 addition & 33 deletions .drone/drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,38 +132,6 @@ workspace:
path: loki
---
kind: pipeline
name: mixins
steps:
- commands:
- make BUILD_IN_CONTAINER=false lint-jsonnet
depends_on:
- clone
environment: {}
image: grafana/jsonnet-build:c8b75df
name: lint-jsonnet
- commands:
- make BUILD_IN_CONTAINER=false loki-mixin-check
depends_on:
- clone
environment: {}
image: grafana/loki-build-image:0.33.1
name: loki-mixin-check
when:
event:
- pull_request
paths:
- production/loki-mixin/**
trigger:
ref:
- refs/heads/main
- refs/heads/k???
- refs/tags/v*
- refs/pull/*/head
workspace:
base: /src
path: loki
---
kind: pipeline
name: documentation-checks
steps:
- commands:
Expand Down Expand Up @@ -1340,6 +1308,6 @@ kind: secret
name: gpg_private_key
---
kind: signature
hmac: dbc4d2b5c84e0464f24846abc8e7e73a5a937df289a0ecdb501f3bca28ebb8e3
hmac: e0940674c7a2b5ae47c6509b0bc97dc594a054e5b881fd1962b81837d6b1dee6

...
32 changes: 32 additions & 0 deletions .github/workflows/lint-jsonnet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
name: lint-jsonnet
on: [pull_request]
# pull_request:
# paths: "production/**"

jobs:
check-mixin:
name: Check mixin jsonnet files
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: setup go
uses: actions/setup-go@v5
with:
go-version: '1.22.2'
- name: setup jsonnet
run: |
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/google/go-jsonnet/cmd/[email protected]
go install github.com/monitoring-mixins/mixtool/cmd/mixtool@16dc166166d91e93475b86b9355a4faed2400c18
go install github.com/jsonnet-bundler/jsonnet-bundler/cmd/[email protected]
- name: run linting
run: make BUILD_IN_CONTAINER=false lint-jsonnet
- name: check compiled mixin has been updated
run: |
make BUILD_IN_CONTAINER=false loki-mixin-check


3 changes: 3 additions & 0 deletions cmd/loki/loki-local-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ schema_config:
ruler:
alertmanager_url: http://localhost:9093

frontend:
encoding: protobuf

# By default, Loki will send anonymous, but uniquely-identifiable usage and configuration
# analytics to Grafana Labs. These statistics are sent to https://stats.grafana.org/
#
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/alert/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ ruler:
url: http://localhost:9090/api/v1/write
```

Further configuration options can be found under [ruler]({{< relref "../configure#ruler" >}}).
Further configuration options can be found under [ruler](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#ruler).

### Operations

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/configure/bp-configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Loki can cache data at many levels, which can drastically improve performance. D

## Time ordering of logs

Loki [accepts out-of-order writes]({{< relref "../configure#accept-out-of-order-writes" >}}) _by default_.
Loki [accepts out-of-order writes](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#accept-out-of-order-writes) _by default_.
This section identifies best practices when Loki is _not_ configured to accept out-of-order writes.

One issue many people have with Loki is their client receiving errors for out of order log entries. This happens because of this hard and fast rule within Loki:
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/get-started/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ Currently the only way the distributor mutates incoming data is by normalizing l
The distributor can also rate limit incoming logs based on the maximum data ingest rate per tenant. It does this by checking a per-tenant limit and dividing it by the current number of distributors. This allows the rate limit to be specified per tenant at the cluster level and enables us to scale the distributors up or down and have the per-distributor limit adjust accordingly. For instance, say we have 10 distributors and tenant A has a 10MB rate limit. Each distributor will allow up to 1MB/s before limiting. Now, say another large tenant joins the cluster and we need to spin up 10 more distributors. The now 20 distributors will adjust their rate limits for tenant A to `(10MB / 20 distributors) = 500KB/s`. This is how global limits allow much simpler and safer operation of the Loki cluster.

{{% admonition type="note" %}}
The distributor uses the `ring` component under the hood to register itself amongst its peers and get the total number of active distributors. This is a different "key" than the ingesters use in the ring and comes from the distributor's own [ring configuration]({{< relref "../configure#distributor" >}}).
The distributor uses the `ring` component under the hood to register itself amongst its peers and get the total number of active distributors. This is a different "key" than the ingesters use in the ring and comes from the distributor's own [ring configuration](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#distributor).
{{% /admonition %}}

### Forwarding
Expand Down Expand Up @@ -172,7 +172,7 @@ deduplicated.

### Timestamp Ordering

Loki is configured to [accept out-of-order writes]({{< relref "../configure#accept-out-of-order-writes" >}}) by default.
Loki is configured to [accept out-of-order writes](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#accept-out-of-order-writes) by default.

When not configured to accept out-of-order writes, the ingester validates that ingested log lines are in order. When an
ingester receives a log line that doesn't follow the expected order, the line
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/get-started/deployment-modes.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The simplest mode of operation is the monolithic deployment mode. You enable mon

Monolithic mode is useful for getting started quickly to experiment with Loki, as well as for small read/write volumes of up to approximately 20GB per day.

You can horizontally scale a monolithic mode deployment to more instances by using a shared object store, and by configuring the [`ring` section]({{< relref "../configure#common" >}}) of the `loki.yaml` file to share state between all instances, but the recommendation is to use simple scalable mode if you need to scale your deployment.
You can horizontally scale a monolithic mode deployment to more instances by using a shared object store, and by configuring the [`ring` section](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#common) of the `loki.yaml` file to share state between all instances, but the recommendation is to use simple scalable mode if you need to scale your deployment.

You can configure high availability by running two Loki instances using `memberlist_config` configuration and a shared object store and setting the `replication_factor` to `3`. You route traffic to all the Loki instances in a round robin fashion.

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/get-started/hash-rings.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ For each node, the key-value store holds:

## Configuring rings

Define [ring configuration]({{< relref "../configure#common" >}}) within the `common.ring_config` block.
Define [ring configuration](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#common) within the `common.ring_config` block.

Use the default `memberlist` key-value store type unless there is
a compelling reason to use a different key-value store type.
Expand Down
9 changes: 7 additions & 2 deletions docs/sources/operations/automatic-stream-sharding.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,23 +12,28 @@ existing streams. When properly tuned, this should eliminate issues where log pr
per-stream rate limit.

**To enable automatic stream sharding:**
1. Edit the global [limits_config]({{< relref "../configure#limits_config" >}}) of the Loki configuration file:
1. Edit the global [`limits_config`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#limits_config) of the Loki configuration file:

```yaml
limits_config:
shard_streams:
enabled: true
```
1. Optionally lower the `desired_rate` in bytes if you find that the system is still hitting the `per_stream_rate_limit`:

```yaml
limits_config:
shard_streams:
enabled: true
desired_rate: 2097152 #2MiB
```
1. Optionally enable `logging_enabled` for debugging stream sharding.

1. Optionally enable `logging_enabled` for debugging stream sharding.
{{% admonition type="note" %}}
This may affect the ingestion performance of Loki.
{{% /admonition %}}

```yaml
limits_config:
shard_streams:
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operations/blocking-queries.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ In certain situations, you may not be able to control the queries being sent to
may be intentionally or unintentionally expensive to run, and they may affect the overall stability or cost of running
your service.

You can block queries using [per-tenant overrides]({{< relref "../configure#runtime-configuration-file" >}}), like so:
You can block queries using [per-tenant overrides](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#runtime-configuration-file), like so:

```yaml
overrides:
Expand All @@ -36,7 +36,7 @@ overrides:
types: filter,limited
```
{{% admonition type="note" %}}
Changes to these configurations **do not require a restart**; they are defined in the [runtime configuration file]({{< relref "../configure#runtime-configuration-file" >}}).
Changes to these configurations **do not require a restart**; they are defined in the [runtime configuration file](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#runtime-configuration-file).
{{% /admonition %}}
The available query types are:
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/operations/overrides-exporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Loki is a multi-tenant system that supports applying limits to each tenant as a

## Context

Configuration updates to tenant limits can be applied to Loki without restart via the [`runtime_config`]({{< relref "../configure#runtime_config" >}}) feature.
Configuration updates to tenant limits can be applied to Loki without restart via the [`runtime_config`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#runtime_config) feature.

## Example

Expand Down
6 changes: 3 additions & 3 deletions docs/sources/operations/recording-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ weight:

Recording rules are evaluated by the `ruler` component. Each `ruler` acts as its own `querier`, in the sense that it
executes queries against the store without using the `query-frontend` or `querier` components. It will respect all query
[limits]({{< relref "../configure#limits_config" >}}) put in place for the `querier`.
[limits](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#limits_config) put in place for the `querier`.

Loki's implementation of recording rules largely reuses Prometheus' code.

Expand Down Expand Up @@ -77,8 +77,8 @@ so a `Persistent Volume` should be utilised.
### Per-Tenant Limits

Remote-write can be configured at a global level in the base configuration, and certain parameters tuned specifically on
a per-tenant basis. Most of the configuration options [defined here]({{< relref "../configure#ruler" >}})
have [override options]({{< relref "../configure#limits_config" >}}) (which can be also applied at runtime!).
a per-tenant basis. Most of the configuration options [defined here](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#ruler)
have [override options](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#limits_config) (which can be also applied at runtime!).

### Tuning

Expand Down
6 changes: 3 additions & 3 deletions docs/sources/operations/storage/boltdb-shipper.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,14 @@ Within Kubernetes, if you are not using an Index Gateway, we recommend running Q
An Index Gateway downloads and synchronizes the BoltDB index from the Object Storage in order to serve index queries to the Queriers and Rulers over gRPC.
This avoids running Queriers and Rulers with a disk for persistence. Disks can become costly in a big cluster.

To run an Index Gateway, configure [StorageConfig]({{< relref "../../configure#storage_config" >}}) and set the `-target` CLI flag to `index-gateway`.
To connect Queriers and Rulers to the Index Gateway, set the address (with gRPC port) of the Index Gateway with the `-boltdb.shipper.index-gateway-client.server-address` CLI flag or its equivalent YAML value under [StorageConfig]({{< relref "../../configure#storage_config" >}}).
To run an Index Gateway, configure [StorageConfig](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#storage_config) and set the `-target` CLI flag to `index-gateway`.
To connect Queriers and Rulers to the Index Gateway, set the address (with gRPC port) of the Index Gateway with the `-boltdb.shipper.index-gateway-client.server-address` CLI flag or its equivalent YAML value under [StorageConfig](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#storage_config).

When using the Index Gateway within Kubernetes, we recommend using a StatefulSet with persistent storage for downloading and querying index files. This can obtain better read performance, avoids [noisy neighbor problems](https://en.wikipedia.org/wiki/Cloud_computing_issues#Performance_interference_and_noisy_neighbors) by not using the node disk, and avoids the time consuming index downloading step on startup after rescheduling to a new node.

### Write Deduplication disabled

Loki does write deduplication of chunks and index using Chunks and WriteDedupe cache respectively, configured with [ChunkStoreConfig]({{< relref "../../configure#chunk_store_config" >}}).
Loki does write deduplication of chunks and index using Chunks and WriteDedupe cache respectively, configured with [ChunkStoreConfig](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#chunk_store_config).
The problem with write deduplication when using `boltdb-shipper` though is ingesters only keep uploading boltdb files periodically to make them available to all the other services which means there would be a brief period where some of the services would not have received updated index yet.
The problem due to that is if an ingester which first wrote the chunks and index goes down and all the other ingesters which were part of replication scheme skipped writing those chunks and index due to deduplication, we would end up missing those logs from query responses since only the ingester which had the index went down.
This problem would be faced even during rollouts which is quite common.
Expand Down
2 changes: 1 addition & 1 deletion docs/sources/operations/storage/schema/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ schema_config:
| Property | Description |
|--------------|--------------------------------------------------------------------------------------------------------------------------------------------------------|
| from | for a new install, this must be a date in the past, use a recent date. Format is YYYY-MM-DD. |
| object_store | s3, azure, gcs, alibabacloud, bos, cos, swift, filesystem, or a named_store (see [StorageConfig]({{< relref "../../../configure#storage_config" >}})). |
| object_store | s3, azure, gcs, alibabacloud, bos, cos, swift, filesystem, or a named_store (see [StorageConfig](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#storage_config)). |
| store | `tsdb` is the current and only recommended value for store. |
| schema | `v13` is the most recent schema and recommended value. |
| prefix: | any value without spaces is acceptable. |
Expand Down
10 changes: 5 additions & 5 deletions docs/sources/operations/storage/table-manager/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ to store chunks, are not managed by the Table Manager, and a custom bucket polic
should be set to delete old data.

For detailed information on configuring the Table Manager, refer to the
[`table_manager`]({{< relref "../../../configure#table_manager" >}})
[`table_manager`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#table_manager)
section in the Loki configuration document.


Expand All @@ -58,10 +58,10 @@ section in the Loki configuration document.
A periodic table stores the index or chunk data relative to a specific period
of time. The duration of the time range of the data stored in a single table and
its storage type is configured in the
[`schema_config`]({{< relref "../../../configure#schema_config" >}}) configuration
[`schema_config`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#schema_config) configuration
block.

The [`schema_config`]({{< relref "../../../configure#schema_config" >}}) can contain
The [`schema_config`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#schema_config) can contain
one or more `configs`. Each config, defines the storage used between the day
set in `from` (in the format `yyyy-mm-dd`) and the next config, or "now"
in the case of the last schema config entry.
Expand Down Expand Up @@ -115,7 +115,7 @@ order to make sure that the new table is ready once the current table end
period is reached.
The `creation_grace_period` property - in the
[`table_manager`]({{< relref "../../../configure#table_manager" >}})
[`table_manager`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#table_manager)
configuration block - defines how long before a table should be created.


Expand Down Expand Up @@ -161,7 +161,7 @@ documentation.
A table can be active or inactive.

A table is considered **active** if the current time is within the range:
- Table start period - [`creation_grace_period`]({{< relref "../../../configure#table_manager" >}})
- Table start period - [`creation_grace_period`](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#table_manager)
- Table end period + max chunk age (hardcoded to `12h`)

![active_vs_inactive_tables](./table-manager-active-vs-inactive-tables.png)
Expand Down
4 changes: 2 additions & 2 deletions docs/sources/operations/storage/tsdb.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,12 @@ We've added a user per-tenant limit called `tsdb_max_query_parallelism` in the `

### Dynamic Query Sharding

Previously we would statically shard queries based on the index row shards configured [here]({{< relref "../../configure#period_config" >}}).
Previously we would statically shard queries based on the index row shards configured [here](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#period_config).
TSDB does Dynamic Query Sharding based on how much data a query is going to be processing.
We additionally store size(KB) and number of lines for each chunk in the TSDB index which is then used by the [Query Frontend]({{< relref "../../get-started/components#query-frontend" >}}) for planning the query.
Based on our experience from operating many Loki clusters, we have configured TSDB to aim for processing 300-600 MBs of data per query shard.
This means with TSDB we will be running more, smaller queries.

### Index Caching not required

TSDB is a compact and optimized format. Loki does not currently use an index cache for TSDB. If you are already using Loki with other index types, it is recommended to keep the index caching until all of your existing data falls out of [retention]({{< relref "./retention" >}}) or your configured `max_query_lookback` under [limits_config]({{< relref "../../configure#limits_config" >}}). After that, we suggest running without an index cache (it isn't used in TSDB).
TSDB is a compact and optimized format. Loki does not currently use an index cache for TSDB. If you are already using Loki with other index types, it is recommended to keep the index caching until all of your existing data falls out of [retention](https://grafana.com/docs/loki/<LOKI_VERSION>/operations/storage/retention/)) or your configured `max_query_lookback` under [limits_config](https://grafana.com/docs/loki/<LOKI_VERSION>/configure/#limits_config). After that, we suggest running without an index cache (it isn't used in TSDB).
Loading

0 comments on commit 04e6968

Please sign in to comment.