Skip to content

Commit

Permalink
Merge branch 'main' into paul1r/add_metrics_for_duplicate_log_line_bytes
Browse files Browse the repository at this point in the history
  • Loading branch information
paul1r authored Jun 26, 2024
2 parents 982ebf6 + 7e19cc7 commit 00f9b82
Show file tree
Hide file tree
Showing 67 changed files with 1,334 additions and 446 deletions.
14 changes: 14 additions & 0 deletions cmd/loki/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func main() {
}()
}

setProfilingOptions(config.Profiling)

// Allocate a block of memory to reduce the frequency of garbage collection.
// The larger the ballast, the lower the garbage collection frequency.
// https://github.com/grafana/loki/issues/781
Expand All @@ -127,3 +129,15 @@ func main() {
err = t.Run(loki.RunOpts{StartTime: startTime})
util_log.CheckFatal("running loki", err, util_log.Logger)
}

func setProfilingOptions(cfg loki.ProfilingConfig) {
if cfg.BlockProfileRate > 0 {
runtime.SetBlockProfileRate(cfg.BlockProfileRate)
}
if cfg.CPUProfileRate > 0 {
runtime.SetCPUProfileRate(cfg.CPUProfileRate)
}
if cfg.MutexProfileFraction > 0 {
runtime.SetMutexProfileFraction(cfg.MutexProfileFraction)
}
}
2 changes: 1 addition & 1 deletion docs/sources/query/log_queries/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ For example with `cluster="namespace"` the cluster is the label identifier, the
We support multiple **value** types which are automatically inferred from the query input.

- **String** is double quoted or backticked such as `"200"` or \``us-central1`\`.
- **[Duration](https://golang.org/pkg/time/#ParseDuration)** is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h".
- **[Duration](https://golang.org/pkg/time/#ParseDuration)** is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "300ms", "1.5h" or "2h45m". Valid time units are "ns", "us" (or "µs"), "ms", "s", "m", "h". The value of the label identifier used for comparison must be a string with a unit suffix to be parsed correctly, such as "0.10ms" or "1h30m". Optionally, `label_format` can be used to modify the value and append the unit before making the comparison.
- **Number** are floating-point number (64bits), such as`250`, `89.923`.
- **Bytes** is a sequence of decimal numbers, each with optional fraction and a unit suffix, such as "42MB", "1.5Kib" or "20b". Valid bytes units are "b", "kib", "kb", "mib", "mb", "gib", "gb", "tib", "tb", "pib", "pb", "eib", "eb".

Expand Down
4 changes: 2 additions & 2 deletions docs/sources/send-data/docker-driver/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ Stack name and service name for each swarm service and project name and service

## Labels

Loki can received a set of labels along with log line. These labels are used to index log entries and query back logs using [LogQL stream selector]({{< relref "../../query/log_queries#log-stream-selector" >}}).
Loki can receive a set of labels along with log line. These labels are used to index log entries and query back logs using [LogQL stream selector]({{< relref "../../query/log_queries#log-stream-selector" >}}).

By default, the Docker driver will add the following labels to each log line:

Expand All @@ -128,7 +128,7 @@ next section for all supported options.
## Pipeline stages

While you can provide `loki-pipeline-stage-file` it can be hard to mount the configuration file to the driver root filesystem.
This is why another option `loki-pipeline-stages` is available allowing your to pass a list of stages inlined. Pipeline stages are run at last on every lines.
This is why another option `loki-pipeline-stages` is available allowing you to pass a list of stages inlined. Pipeline stages are run at last on every lines.

The example [docker-compose](https://github.com/grafana/loki/blob/main/clients/cmd/docker-driver/docker-compose.yaml) below configures 2 stages, one to extract level values and one to set it as a label:

Expand Down
8 changes: 4 additions & 4 deletions docs/sources/send-data/k6/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ weight: 900

# Using k6 for load testing

Grafana [k6](https://k6.io) is a modern load-testing tool.
Its clean and approachable scripting [API](https://k6.io/docs/javascript-api/)
Grafana [k6](https://grafana.com/oss/k6/) is a modern load-testing tool.
Its clean and approachable scripting [API](https://grafana.com/docs/k6/latest/javascript-api/)
works locally or in the cloud.
Its configuration makes it flexible.

Expand Down Expand Up @@ -55,7 +55,7 @@ Use the custom-built k6 binary in the same way as a non-custom k6 binary:
```

`test.js` is a Javascript load test.
Refer to the [k6 documentation](https://k6.io/docs/) to get started.
Refer to the [k6 documentation](https://grafana.com/docs/k6/latest/) to get started.

### Scripting API

Expand All @@ -75,7 +75,7 @@ Classes of this module are:
| `Client` | client for writing and reading logs from Loki |

`Config` and `Client` must be called on the k6 init context (see
[Test life cycle](https://k6.io/docs/using-k6/test-life-cycle/)) outside of the
[Test life cycle](https://grafana.com/docs/k6/latest/using-k6/test-lifecycle/)) outside of the
default function so the client is only configured once and shared between all
VU iterations.

Expand Down
2 changes: 1 addition & 1 deletion docs/sources/send-data/k6/query-scenario.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export default () => {
## Metrics

The extension collects metrics that are printed in the
[end-of-test summary](https://k6.io/docs/results-visualization/end-of-test-summary/) in addition to the built-in metrics.
[end-of-test summary](https://grafana.com/docs/k6/latest/results-output/end-of-test/) in addition to the built-in metrics.
These metrics are collected only for instant and range queries.

| name | description |
Expand Down
8 changes: 4 additions & 4 deletions docs/sources/send-data/k6/write-scenario.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,17 @@ These parameters can be adjusted in the load test:

* The way to run k6

k6 supports three [execution modes](https://k6.io/docs/get-started/running-k6/#execution-modes) to run a test: local, distributed, and cloud.
k6 supports three [execution modes](https://grafana.com/docs/k6/latest/get-started/running-k6/#execution-modes) to run a test: local, distributed, and cloud.
Whereas running your k6 load test from a single (local
or remote) machine is easy to set up and fine for smaller Loki clusters,
the single machine does not load test large Loki installations,
because it cannot create the data to saturate the write path.
For larger tests, consider [these optimizations](https://k6.io/docs/testing-guides/running-large-tests/), or run them in [Grafana Cloud k6](/products/cloud/k6) or a Kubernetes cluster with the [k6 Operator](https://github.com/grafana/k6-operator).
For larger tests, consider [these optimizations](https://grafana.com/docs/k6/latest/testing-guides/running-large-tests/), or run them in [Grafana Cloud k6](/products/cloud/k6) or a Kubernetes cluster with the [k6 Operator](https://github.com/grafana/k6-operator).

## Metrics

The extension collects two metrics that are printed in the
[end-of-test summary](https://k6.io/docs/results-visualization/end-of-test-summary/) in addition to the built-in metrics.
[end-of-test summary](https://grafana.com/docs/k6/latest/results-output/end-of-test/) in addition to the built-in metrics.

| name | description |
| ---- | ----------- |
Expand All @@ -80,7 +80,7 @@ The extension collects two metrics that are printed in the

An HTTP request that successfully pushes logs to Loki
responds with status `204 No Content`.
The status code should be checked explicitly with a [k6 check](https://k6.io/docs/javascript-api/k6/check-val-sets-tags/).
The status code should be checked explicitly with a [k6 check](https://grafana.com/docs/k6/latest/javascript-api/k6/check/).


## Javascript example
Expand Down
9 changes: 9 additions & 0 deletions docs/sources/setup/install/helm/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -3487,6 +3487,15 @@ null
<td><pre lang="json">
null
</pre>
</td>
</tr>
<tr>
<td>gateway.containerPort</td>
<td>int</td>
<td>Default container port</td>
<td><pre lang="json">
8080
</pre>
</td>
</tr>
<tr>
Expand Down
34 changes: 34 additions & 0 deletions docs/sources/shared/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,19 @@ bloom_build:
# CLI flag: -bloom-build.builder.planner-address
[planner_address: <string> | default = ""]

backoff_config:
# Minimum delay when backing off.
# CLI flag: -bloom-build.builder.backoff.backoff-min-period
[min_period: <duration> | default = 100ms]

# Maximum delay when backing off.
# CLI flag: -bloom-build.builder.backoff.backoff-max-period
[max_period: <duration> | default = 10s]

# Number of times to backoff and retry before failing.
# CLI flag: -bloom-build.builder.backoff.backoff-retries
[max_retries: <int> | default = 10]

# Experimental: The bloom_gateway block configures the Loki bloom gateway
# server, responsible for serving queries for filtering chunks based on filter
# expressions.
Expand Down Expand Up @@ -567,6 +580,9 @@ compactor_grpc_client:
# Configuration for analytics.
[analytics: <analytics>]

# Configuration for profiling options.
[profiling: <profiling>]

# Common configuration to be shared between multiple modules. If a more specific
# configuration is given in other sections, the related configuration within
# this section will be ignored.
Expand Down Expand Up @@ -3858,6 +3874,24 @@ chunks:
[row_shards: <int> | default = 16]
```

### profiling

Configuration for `profiling` options.

```yaml
# Sets the value for runtime.SetBlockProfilingRate
# CLI flag: -profiling.block-profile-rate
[block_profile_rate: <int> | default = 0]
# Sets the value for runtime.SetCPUProfileRate
# CLI flag: -profiling.cpu-profile-rate
[cpu_profile_rate: <int> | default = 0]
# Sets the value for runtime.SetMutexProfileFraction
# CLI flag: -profiling.mutex-profile-fraction
[mutex_profile_fraction: <int> | default = 0]
```

### querier

Configures the `querier`. Only appropriate when running all modules or just the querier.
Expand Down
Loading

0 comments on commit 00f9b82

Please sign in to comment.