Skip to content

Commit d9e8b48

Browse files
committed
Squashed commit of the following:
commit 0bfd0ad Merge: 68aa188 efdae3d Author: Trevor Whitney <[email protected]> Date: Thu May 23 17:04:32 2024 -0600 Merge branch 'main' into sample-count-and-bytes commit 68aa188 Author: Trevor Whitney <[email protected]> Date: Thu May 23 17:03:32 2024 -0600 feat: guard aggregation behavior behind a feature flag commit efdae3d Author: hayden <[email protected]> Date: Thu May 23 16:25:50 2024 -0400 feat(helm): Support for PVC Annotations for Non-Distributed Modes (#12023) Signed-off-by: hfuss <[email protected]> Co-authored-by: J Stickler <[email protected]> Co-authored-by: Trevor Whitney <[email protected]> commit f0d6a92 Author: Trevor Whitney <[email protected]> Date: Thu May 23 14:03:32 2024 -0600 feat: reject filter queries to /patterns endpoint commit dc620e7 Author: Trevor Whitney <[email protected]> Date: Wed May 8 14:08:44 2024 -0600 feat: collect and serve pre-agg bytes and count * pre-aggregate bytes and count per stream in the pattern ingester * serve bytes_over_time and count_over_time queries from the patterns endpoint commit 97212ea Author: Jay Clifford <[email protected]> Date: Thu May 23 12:10:48 2024 -0400 feat: Added Interactive Sandbox to Quickstart tutorial (#12701) commit 1111595 Author: Vladyslav Diachenko <[email protected]> Date: Thu May 23 13:18:16 2024 +0300 feat: new stream count limiter (#13006) Signed-off-by: Vladyslav Diachenko <[email protected]> Co-authored-by: JordanRushing <[email protected]> commit 987e551 Author: Quentin Bisson <[email protected]> Date: Thu May 23 02:15:52 2024 +0200 fix: allow cluster label override in bloom dashboards (#13012) Signed-off-by: QuentinBisson <[email protected]> commit d3c9cec Author: Quentin Bisson <[email protected]> Date: Thu May 23 01:59:28 2024 +0200 fix: upgrade old plugin for the loki-operational dashboard. (#13016) Signed-off-by: QuentinBisson <[email protected]> commit 8d9fb68 Author: Quentin Bisson <[email protected]> Date: Wed May 22 22:00:08 2024 +0200 fix: remove unneccessary disk panels for ssd read path (#13014) Signed-off-by: QuentinBisson <[email protected]> commit 1948899 Author: Quentin Bisson <[email protected]> Date: Wed May 22 15:16:29 2024 +0200 fix: Mixins - Add missing log datasource on loki-deletion (#13011) commit efd8f5d Author: Salva Corts <[email protected]> Date: Wed May 22 10:43:32 2024 +0200 refactor(blooms): Add queue to bloom planner and enqueue tasks (#13005) commit d6f29fc Author: Vitor Gomes <[email protected]> Date: Wed May 22 04:34:42 2024 +1200 docs: update otlp ingestion with correct endpoint and add endpoint to reference api docs (#12996) commit 3195036 Author: Salva Corts <[email protected]> Date: Tue May 21 13:12:24 2024 +0200 refactor(bloom planner): Compute gaps and build tasks from metas and TSDBs (#12994) commit 7a3338e Author: Jonathan Davies <[email protected]> Date: Tue May 21 10:41:42 2024 +0100 feat: loki/main.go: Log which config file path is used on startup (#12985) Co-authored-by: Michel Hollands <[email protected]> commit bf8a278 Author: Ashwanth <[email protected]> Date: Tue May 21 12:56:07 2024 +0530 chore: remove duplicate imports (#13001) commit 1f5291a Author: Ashwanth <[email protected]> Date: Tue May 21 12:38:02 2024 +0530 fix(indexstats): do not collect stats from "IndexStats" lookups for other query types (#12978) commit 8442dca Author: Jay Clifford <[email protected]> Date: Mon May 20 17:52:17 2024 -0400 feat: Added getting started video (#12975) commit 75ccf21 Author: Christian Haudum <[email protected]> Date: Mon May 20 17:14:40 2024 +0200 feat(blooms): Separate page buffer pools for series pages and bloom pages (#12992) Series pages are much smaller than bloom pages and therefore can make use of a separate buffer pool with different buckets. The second commit fixes a possible panic. Signed-off-by: Christian Haudum <[email protected]> commit 94d610e Author: Yarden Shoham <[email protected]> Date: Mon May 20 18:05:50 2024 +0300 docs: Fix broken link in the release notes (#12990) Co-authored-by: J Stickler <[email protected]> commit 31a1314 Author: choeffer <[email protected]> Date: Mon May 20 16:39:25 2024 +0200 docs(install-monolithic): add quotation marks (#12982) Co-authored-by: Michel Hollands <[email protected]> commit 8978ecf Author: Salva Corts <[email protected]> Date: Mon May 20 12:36:22 2024 +0200 feat: Boilerplate for new bloom build planner and worker components. (#12989)
1 parent 5b80095 commit d9e8b48

File tree

94 files changed

+6356
-793
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

94 files changed

+6356
-793
lines changed

cmd/loki/loki-local-config.yaml

+3
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ schema_config:
3333
prefix: index_
3434
period: 24h
3535

36+
pattern_ingester:
37+
enabled: true
38+
3639
ruler:
3740
alertmanager_url: http://localhost:9093
3841

cmd/loki/main.go

+1
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ func main() {
118118
}
119119

120120
level.Info(util_log.Logger).Log("msg", "Starting Loki", "version", version.Info())
121+
level.Info(util_log.Logger).Log("msg", "Loading configuration file", "filename", config.ConfigFile)
121122

122123
err = t.Run(loki.RunOpts{StartTime: startTime})
123124
util_log.CheckFatal("running loki", err, util_log.Logger)

docs/Makefile

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ include docs.mk
1010
PODMAN := $(shell if command -v podman >/dev/null 2>&1; then echo podman; else echo docker; fi)
1111
BUILD_IN_CONTAINER ?= true
1212

13+
.PHONY: sources/setup/install/helm/reference.md
1314
sources/setup/install/helm/reference.md: ../production/helm/loki/reference.md.gotmpl ../production/helm/loki/values.yaml
1415
ifeq ($(BUILD_IN_CONTAINER),true)
1516
$(PODMAN) run --rm --volume "$(realpath ..):/helm-docs" -u "$$(id -u)" "docker.io/jnorwood/helm-docs:v1.11.0" \

docs/sources/get-started/_index.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: Provides an overview of the steps for implementing Grafana Loki to
77

88
# Get started with Grafana Loki
99

10+
{{< youtube id="1uk8LtQqsZQ" >}}
11+
1012
Loki is a horizontally-scalable, highly-available, multi-tenant log aggregation system inspired by Prometheus. It is designed to be very cost effective and easy to operate. It does not index the contents of the logs, but rather a set of labels for each log stream.
1113

1214
Because all Loki implementations are unique, the installation process is

docs/sources/get-started/quick-start.md

+12
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,18 @@ The Docker Compose configuration instantiates the following components, each in
2222

2323
{{< figure max-width="75%" src="/media/docs/loki/get-started-flog-v3.png" caption="Getting started sample application" alt="Getting started sample application">}}
2424

25+
## Interactive Learning Environment
26+
27+
{{< admonition type="note" >}}
28+
The Interactive Learning Environment is currently in trial. Please provide feedback, report bugs, and raise issues in the [Grafana Killercoda Repository](https://github.com/grafana/killercoda).
29+
{{< /admonition >}}
30+
31+
Try out this demo within our interactive learning environment: [Loki Quickstart Sandbox](https://killercoda.com/grafana-labs/course/loki/loki-quickstart)
32+
33+
- A free Killercoda account is required to verify you are not a bot.
34+
- Tutorial instructions are located on the left-hand side of the screen. Click to move on to the next section.
35+
- All commands run inside the interactive terminal. Grafana can also be accessed via the URL links provided within the sandbox.
36+
2537
## Installing Loki and collecting sample logs
2638

2739
Prerequisites

docs/sources/reference/loki-http-api.md

+11
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ Authorization needs to be done separately, for example, using an open-source loa
2424
These endpoints are exposed by the `distributor`, `write`, and `all` components:
2525

2626
- [`POST /loki/api/v1/push`](#ingest-logs)
27+
- [`POST /otlp/v1/logs`](#ingest-logs-using-otlp)
2728

2829
A [list of clients]({{< relref "../send-data" >}}) can be found in the clients documentation.
2930

@@ -260,6 +261,16 @@ curl -H "Content-Type: application/json" \
260261
--data-raw '{"streams": [{ "stream": { "foo": "bar2" }, "values": [ [ "1570818238000000000", "fizzbuzz" ] ] }]}'
261262
```
262263

264+
## Ingest logs using OTLP
265+
266+
```bash
267+
POST /otlp/v1/logs
268+
```
269+
270+
`/otlp/v1/logs` lets the OpenTelemetry Collector send logs to Loki using `otlphttp` procotol.
271+
272+
For information on how to configure Loki, refer to the [OTel Collector topic](https://grafana.com/docs/loki/<LOKI_VERSION>/send-data/otel/).
273+
263274
## Query logs at a single point in time
264275

265276
```bash

docs/sources/release-notes/_index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ weight: 100
88
Release notes for Loki are in the CHANGELOG for the release and
99
listed here by version number.
1010

11-
- [V3.0 release notes](https://grafana.com/docs/loki/<LOKI_VERSION>/release-notes/v3.0/)
11+
- [V3.0 release notes](https://grafana.com/docs/loki/<LOKI_VERSION>/release-notes/v3-0/)
1212
- [V2.9 release notes](https://grafana.com/docs/loki/<LOKI_VERSION>/release-notes/v2-9/)
1313
- [V2.8 release notes](https://grafana.com/docs/loki/<LOKI_VERSION>/release-notes/v2-8/)
1414
- [V2.7 release notes](https://grafana.com/docs/loki/<LOKI_VERSION>/release-notes/v2-7/)

docs/sources/send-data/otel/_index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ You need to make the following changes to the [OpenTelemetry Collector config](h
3030
```yaml
3131
exporters:
3232
otlphttp:
33-
endpoint: http://<loki-addr>:3100/otlp
33+
endpoint: http://<loki-addr>:3100/otlp/v1/logs
3434
```
3535
3636
And enable it in `service.pipelines`:
@@ -57,7 +57,7 @@ exporters:
5757
otlphttp:
5858
auth:
5959
authenticator: basicauth/otlp
60-
endpoint: http://<loki-addr>:3100/otlp
60+
endpoint: http://<loki-addr>:3100/otlp/v1/logs
6161
6262
service:
6363
extensions: [basicauth/otlp]

docs/sources/setup/install/helm/install-monolithic/_index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ If you set the `singleBinary.replicas` value to 2 or more, this chart configures
4747
type: 'filesystem'
4848
schemaConfig:
4949
configs:
50-
- from: 2024-01-01
50+
- from: "2024-01-01"
5151
store: tsdb
5252
index:
5353
prefix: loki_index_
@@ -72,7 +72,7 @@ If you set the `singleBinary.replicas` value to 2 or more, this chart configures
7272
replication_factor: 3
7373
schemaConfig:
7474
configs:
75-
- from: 2024-01-01
75+
- from: "2024-01-01"
7676
store: tsdb
7777
index:
7878
prefix: loki_index_

docs/sources/setup/install/helm/reference.md

+39
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,7 @@ This is the generated reference for the Loki Helm Chart values.
315315
"initContainers": [],
316316
"nodeSelector": {},
317317
"persistence": {
318+
"annotations": {},
318319
"dataVolumeParameters": {
319320
"emptyDir": {}
320321
},
@@ -512,6 +513,15 @@ null
512513
<td><pre lang="json">
513514
{}
514515
</pre>
516+
</td>
517+
</tr>
518+
<tr>
519+
<td>backend.persistence.annotations</td>
520+
<td>object</td>
521+
<td>Annotations for volume claim</td>
522+
<td><pre lang="json">
523+
{}
524+
</pre>
515525
</td>
516526
</tr>
517527
<tr>
@@ -6226,6 +6236,7 @@ false
62266236
"drivesPerNode": 2,
62276237
"enabled": false,
62286238
"persistence": {
6239+
"annotations": {},
62296240
"size": "5Gi"
62306241
},
62316242
"replicas": 1,
@@ -8442,6 +8453,7 @@ false
84428453
"lifecycle": {},
84438454
"nodeSelector": {},
84448455
"persistence": {
8456+
"annotations": {},
84458457
"enableStatefulSetAutoDeletePVC": true,
84468458
"selector": null,
84478459
"size": "10Gi",
@@ -8653,6 +8665,15 @@ false
86538665
<td><pre lang="json">
86548666
{}
86558667
</pre>
8668+
</td>
8669+
</tr>
8670+
<tr>
8671+
<td>read.persistence.annotations</td>
8672+
<td>object</td>
8673+
<td>Annotations for volume claim</td>
8674+
<td><pre lang="json">
8675+
{}
8676+
</pre>
86568677
</td>
86578678
</tr>
86588679
<tr>
@@ -9893,6 +9914,15 @@ null
98939914
<td><pre lang="json">
98949915
{}
98959916
</pre>
9917+
</td>
9918+
</tr>
9919+
<tr>
9920+
<td>singleBinary.persistence.annotations</td>
9921+
<td>object</td>
9922+
<td>Annotations for volume claim</td>
9923+
<td><pre lang="json">
9924+
{}
9925+
</pre>
98969926
</td>
98979927
</tr>
98989928
<tr>
@@ -10677,6 +10707,15 @@ null
1067710707
<td><pre lang="json">
1067810708
{}
1067910709
</pre>
10710+
</td>
10711+
</tr>
10712+
<tr>
10713+
<td>write.persistence.annotations</td>
10714+
<td>object</td>
10715+
<td>Annotations for volume claim</td>
10716+
<td><pre lang="json">
10717+
{}
10718+
</pre>
1068010719
</td>
1068110720
</tr>
1068210721
<tr>

docs/sources/shared/configuration.md

+51
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,37 @@ pattern_ingester:
326326
# merging them as bloom blocks.
327327
[bloom_compactor: <bloom_compactor>]
328328

329+
bloom_build:
330+
# Flag to enable or disable the usage of the bloom-planner and bloom-builder
331+
# components.
332+
# CLI flag: -bloom-build.enabled
333+
[enabled: <boolean> | default = false]
334+
335+
planner:
336+
# Interval at which to re-run the bloom creation planning.
337+
# CLI flag: -bloom-build.planner.interval
338+
[planning_interval: <duration> | default = 8h]
339+
340+
# Newest day-table offset (from today, inclusive) to build blooms for.
341+
# Increase to lower cost by not re-writing data to object storage too
342+
# frequently since recent data changes more often at the cost of not having
343+
# blooms available as quickly.
344+
# CLI flag: -bloom-build.planner.min-table-offset
345+
[min_table_offset: <int> | default = 1]
346+
347+
# Oldest day-table offset (from today, inclusive) to compact. This can be
348+
# used to lower cost by not trying to compact older data which doesn't
349+
# change. This can be optimized by aligning it with the maximum
350+
# `reject_old_samples_max_age` setting of any tenant.
351+
# CLI flag: -bloom-build.planner.max-table-offset
352+
[max_table_offset: <int> | default = 2]
353+
354+
# Maximum number of tasks to queue per tenant.
355+
# CLI flag: -bloom-build.planner.max-tasks-per-tenant
356+
[max_queued_tasks_per_tenant: <int> | default = 30000]
357+
358+
builder:
359+
329360
# Experimental: The bloom_gateway block configures the Loki bloom gateway
330361
# server, responsible for serving queries for filtering chunks based on filter
331362
# expressions.
@@ -2947,6 +2978,11 @@ The `limits_config` block configures global and per-tenant limits in Loki. The v
29472978
# CLI flag: -validation.discover-log-levels
29482979
[discover_log_levels: <boolean> | default = true]
29492980

2981+
# When true an ingester takes into account only the streams that it owns
2982+
# according to the ring while applying the stream limit.
2983+
# CLI flag: -ingester.use-owned-stream-count
2984+
[use_owned_stream_count: <boolean> | default = false]
2985+
29502986
# Maximum number of active streams per user, per ingester. 0 to disable.
29512987
# CLI flag: -ingester.max-streams-per-user
29522988
[max_streams_per_user: <int> | default = 0]
@@ -3372,6 +3408,21 @@ shard_streams:
33723408
# CLI flag: -bloom-compactor.max-bloom-size
33733409
[bloom_compactor_max_bloom_size: <int> | default = 128MB]
33743410

3411+
# Experimental. Whether to create blooms for the tenant.
3412+
# CLI flag: -bloom-build.enable
3413+
[bloom_creation_enabled: <boolean> | default = false]
3414+
3415+
# Experimental. Number of splits to create for the series keyspace when building
3416+
# blooms. The series keyspace is split into this many parts to parallelize bloom
3417+
# creation.
3418+
# CLI flag: -bloom-build.split-keyspace-by
3419+
[bloom_split_series_keyspace_by: <int> | default = 256]
3420+
3421+
# Experimental. Maximum number of builders to use when building blooms. 0 allows
3422+
# unlimited builders.
3423+
# CLI flag: -bloom-build.max-builders
3424+
[bloom_build_max_builders: <int> | default = 0]
3425+
33753426
# Experimental. Length of the n-grams created when computing blooms from log
33763427
# lines.
33773428
# CLI flag: -bloom-compactor.ngram-length

pkg/bloombuild/builder/builder.go

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package builder
2+
3+
import (
4+
"context"
5+
6+
"github.com/go-kit/log"
7+
"github.com/grafana/dskit/services"
8+
"github.com/prometheus/client_golang/prometheus"
9+
10+
utillog "github.com/grafana/loki/v3/pkg/util/log"
11+
)
12+
13+
type Worker struct {
14+
services.Service
15+
16+
cfg Config
17+
metrics *Metrics
18+
logger log.Logger
19+
}
20+
21+
func New(
22+
cfg Config,
23+
logger log.Logger,
24+
r prometheus.Registerer,
25+
) (*Worker, error) {
26+
utillog.WarnExperimentalUse("Bloom Builder", logger)
27+
28+
w := &Worker{
29+
cfg: cfg,
30+
metrics: NewMetrics(r),
31+
logger: logger,
32+
}
33+
34+
w.Service = services.NewBasicService(w.starting, w.running, w.stopping)
35+
return w, nil
36+
}
37+
38+
func (w *Worker) starting(_ context.Context) (err error) {
39+
w.metrics.running.Set(1)
40+
return err
41+
}
42+
43+
func (w *Worker) stopping(_ error) error {
44+
w.metrics.running.Set(0)
45+
return nil
46+
}
47+
48+
func (w *Worker) running(_ context.Context) error {
49+
return nil
50+
}

pkg/bloombuild/builder/config.go

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package builder
2+
3+
import "flag"
4+
5+
// Config configures the bloom-builder component.
6+
type Config struct {
7+
// TODO: Add config
8+
}
9+
10+
// RegisterFlagsWithPrefix registers flags for the bloom-planner configuration.
11+
func (cfg *Config) RegisterFlagsWithPrefix(_ string, _ *flag.FlagSet) {
12+
// TODO: Register flags with flagsPrefix
13+
}
14+
15+
func (cfg *Config) Validate() error {
16+
return nil
17+
}
18+
19+
type Limits interface {
20+
// TODO: Add limits
21+
}

pkg/bloombuild/builder/metrics.go

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package builder
2+
3+
import (
4+
"github.com/prometheus/client_golang/prometheus"
5+
"github.com/prometheus/client_golang/prometheus/promauto"
6+
)
7+
8+
const (
9+
metricsNamespace = "loki"
10+
metricsSubsystem = "bloombuilder"
11+
)
12+
13+
type Metrics struct {
14+
running prometheus.Gauge
15+
}
16+
17+
func NewMetrics(r prometheus.Registerer) *Metrics {
18+
return &Metrics{
19+
running: promauto.With(r).NewGauge(prometheus.GaugeOpts{
20+
Namespace: metricsNamespace,
21+
Subsystem: metricsSubsystem,
22+
Name: "running",
23+
Help: "Value will be 1 if the bloom builder is currently running on this instance",
24+
}),
25+
}
26+
}

0 commit comments

Comments
 (0)