feat: added loki streams processing at POST /loki/push#94
Merged
blind-oracle merged 1 commit intoblind-oracle:mainfrom Sep 21, 2025
Merged
feat: added loki streams processing at POST /loki/push#94blind-oracle merged 1 commit intoblind-oracle:mainfrom
blind-oracle merged 1 commit intoblind-oracle:mainfrom
Conversation
Owner
|
Thanks a lot! It's a big thing, I'll try to find some time to read through :) |
Contributor
Author
|
Ah sorry, I am seeing proto parsing errors in our integration tests. I'll fix and push them first. Sorry if you already took a look 😞 |
Signed-off-by: Lukas Schmidt <luk.schm@web.de>
Contributor
Author
|
Now with the latest changes our integration tests run smooth. Sorry for the delay... We also were thinking about adding support for metrics and logs in OpenTelemetry format, but this will be another PR if we decide to support this 😄 |
blind-oracle
approved these changes
Sep 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split Loki Push Requests based on labels/structured metadata
This PR adds a new subpath to
POST /loki/pushthat accepts Loki Ingester Push.It also splits the streams of logs via their labels or structured metadata.
A new configuration option
target_lokican be used to configure the Loki endpoint to send the streams to.The new subpath has its own metrics (named
streamsinstead oftimeseries).I tried to keep the common code within processor.go but needed to split the logic between logs and metrics. The old code can be found in processor_metrics_test.go and handler_metrics.go. The new files for logs are almost identical to the metrics counterpart except for the differing datatypes.
There is also a very minor performance improvement in https://github.com/MrWong99/cortex-tenant/blob/loki/handler_metrics.go#L228 as the old code iterated the outer loop over and over. It will now break on first match but to keep it compatible to the old code I reversed the
cfg.Tenant.LabelListafter it has been read.Sorry for the bigger Pull Request...
We faced the same issue with Label -> Header conversion with Grafana Loki.
I looked at the cortex-tenant code and it seemed straightforward to add this fuctionality, so I did.