7 Commits

Author SHA1 Message Date
4c88be0ef2 chore: update loki modules for 3.0 release (#12433)
Signed-off-by: Edward Welch <edward.welch@grafana.com>
2024-04-02 13:00:17 -04:00
c8d2c32002 feat: Introduce special header that tells Loki not to modify query results (#12327) 2024-03-25 12:50:36 -06:00
782b938334 test: split unit and integrations suites to parallelize (#12039) 2024-02-22 14:34:00 -07:00
390f04d3b2 Fix flaky TestMultiTenantQuery integration test (#11733)
**What this PR does / why we need it**:

Fixes the flaky `TestMultiTenantQuery` integration test.


Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
2024-01-22 09:25:13 +01:00
6069df8f7d ingestion: native otlp ingestion support (#10727)
**What this PR does / why we need it**:
Add support for natively supporting logs ingestion in OTLP format.
`/otlp/v1/logs` is the new endpoint where users can push logs in OTLP
format. It accepts logs serialized in JSON or proto format. Since OTEL
format is very different than what Loki storage model, here is how data
in OTEL format will be mapped to Loki data model:

* Index labels: The Resource Attributes map quite well to Index labels
in Loki since both usually identify the source of the logs. The problem
however is that Resource attributes in OTLP can have an unbounded number
of values while Loki has a default limit of having up to 30 labels.
Since Index labels in Loki can largely drive the kind of querying
experience the users are going to have, we have chosen select attributes
which would be picked as Index Labels. The ones that are not picked up
as Index labels would be stored as Structured Metadata with each log
entry.
* Timestamp: LogRecord.TimeUnixNano
* LogLine: LogRecord.Body holds the body of the log. However, since Loki
only supports Log body in string format, we will stringify non-string
values using [AsString method from OTEL collector
lib](ab3d6c5b64/pdata/pcommon/value.go (L353)).
* Structured Metadata: Anything which can’t be stored in Index labels
and LogLine. Here is a non-exhaustive list of what will be stored in
Structured Metadata to give a sense of what it will hold:
* Resource Attributes not stored as Index labels is replicated and
stored with each log entry.
* Everything under InstrumentationScope is replicated and stored with
each log entry.
* Everything under LogRecord except LogRecord.Body,
LogRecord.TimeUnixNano and sometimes LogRecord.ObservedTimestamp.

*NOTES*:
* Since Loki does not support `.` or any other special characters other
than `_` in label names, we replace all non-supported characters with
`_`.
* Since Loki only supports string in values of Index Labels and
Structured Metadata, all the complex types are converted as follows:
* Map would be flattened into label keys using `_` as separator, same as
how we do it in [json parser in
LogQL](https://grafana.com/docs/loki/latest/query/log_queries/#json).
* Everything else is stringified using [AsString method from OTEL
collector
lib](ab3d6c5b64/pdata/pcommon/value.go (L353))

**Special notes for your reviewer**:
I will open follow-up PRs for:
* Documentation
* Make blessed attributes list configurable per tenant.

**Checklist**
- [x] Tests updated
- [x] `CHANGELOG.md` updated
- [ ] If the change is worth mentioning in the release notes, add
`add-to-release-notes` label
2023-10-23 11:53:36 +02:00
61311957a3 Integration Tests: allow loki logs to be optionally output in integration tests (#8793)
**What this PR does / why we need it**:
Debugging integration tests can be difficult without Loki's logs being
output.

Changing the call from `cluster.New()` to `cluster.New(true,
level.WarnValue())` now allows the author the option to temporarily or
permanently enable logging for their test, as well as configure a level
filter to control the noise.

Signed-off-by: Danny Kopping <danny.kopping@grafana.com>
2023-03-14 10:49:15 -03:00
ad2260aec2 Loki: Fix multitenant querying (#7708)
**What this PR does / why we need it**:
We recently broke multitenant querying because of recent changes to how
timeouts working across Loki. This PR fixes this by:
- Adapt the timeout wrapper to work with multitenant queries. It will
take the shortest timeout across all given tenants
- Adapt the query engine timeout assigning to work with multitenant
queries. It will take the shortest timeout between all the tenants
- Adapt query sharding to use smallest max query parallelism across
given tenants
- Add a functional test to ensure multitenant is behaving as expected

Signed-off-by: DylanGuedes <djmgguedes@gmail.com>
Signed-off-by: Mehmet Burak Devecí <mhmtbrkdvc@gmail.com>

**Which issue(s) this PR fixes**:
https://github.com/grafana/loki/issues/7696

**Special notes for your reviewer**:
The regression was probably introduced by
https://github.com/grafana/loki/pull/7555
2022-11-24 09:14:00 -03:00