10 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
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
b704cf986b Remove flaky helm test (#8122)
This test is causing tens of timeouts across all PRs in our system.
Delete it to improve CI stability
2023-01-12 10:20:17 -08:00
f5fbfabd84 Add 3rd target (backend) to SSD/Scalable mode (#7650)
**What this PR does / why we need it**:

This adds a 3rd target to SSD/Scalable mode, as well as a config flag to
run the legacy `read` mode from the original 2 target configuration in
order to give people time to migrate before we remove this option in
Loki 3.0 (hopefully).

The 3rd target has the two major advantages:
1. Allows the read path to be run as a deployment and thus auto-scaled
using our existing auto-scaling logic for queriers
2. Creates consistency with Mimir since they went with a 3 target model
for their SSD deployment.
2022-12-12 14:01:22 -07:00
e89c30ce6b Fix Flaky Integration Tests (#7360)
Allow the OS kernel to decide what's an open port instead of trying to
guess
2022-10-06 13:17:18 -06:00
2dc5a71a67 Tests: Reduce flakiness of GCPLog and integration tests (#7273)
**What this PR does / why we need it**:
- Reduce flakiness of GCPLog tests by reusing context and stopping GCP
topic
- Reduce flakiness of integration tests by:
  - using port as they're assigned
  - reusing context
- adding timeout to calls (hence, if something get stuck, tests fail
earlier)
2022-09-28 13:37:47 -03:00
5073b48b62 Add integration for SSD (read & write targets) (#6585)
* Add integration for SSD (read & write targets)

* Hardcode randStringRunes to fix linter
2022-07-07 10:05:48 -06:00