Skip to content

refactor(stringlabels): Support stringlabels in chunkenc #17263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

jeschkies
Copy link
Contributor

What this PR does / why we need it:
This is a next step of support Prometheus stringlabels implementation in Loki. It adds support in the chunkenc package.

Special notes for your reviewer:
The tests should compile with build tag stringlabels.

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
    • Note that Promtail is considered to be feature complete, and future development for logs collection will be in Grafana Alloy. As such, feat PRs are unlikely to be accepted unless a case can be made for the feature actually being a bug fix to existing behavior.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

@jeschkies jeschkies mentioned this pull request Apr 16, 2025
30 tasks
@jeschkies
Copy link
Contributor Author

jeschkies commented Apr 16, 2025

TODO:

  • Check BackwardIterator speed with benchmark

}

func (b *BufferedLabelsBuilder) Add(label labels.Label) {
b.buf = append(b.buf, label)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason this shows up in allocations. Even though there should be none.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

› benchstat before.log after.log
goos: linux
goarch: amd64
pkg: github.com/grafana/loki/v3/pkg/chunkenc
cpu: AMD Ryzen 7 3700X 8-Core Processor             
                           │ before.log  │             after.log              │
                           │   sec/op    │   sec/op     vs base               │
BackwardIterator/66_kB-16    17.97m ± 6%   18.23m ± 3%  +1.43% (p=0.007 n=10)
BackwardIterator/262_kB-16   15.83m ± 0%   15.84m ± 0%       ~ (p=0.796 n=10)
BackwardIterator/524_kB-16   12.96m ± 0%   12.75m ± 4%  -1.67% (p=0.003 n=10)
geomean                      15.45m        15.44m       -0.06%

                           │  before.log  │              after.log              │
                           │     B/op     │     B/op      vs base               │
BackwardIterator/66_kB-16    1.197Mi ± 1%   1.200Mi ± 0%       ~ (p=0.247 n=10)
BackwardIterator/262_kB-16   361.6Ki ± 2%   358.2Ki ± 1%       ~ (p=0.315 n=10)
BackwardIterator/524_kB-16   140.3Ki ± 2%   139.5Ki ± 1%       ~ (p=0.247 n=10)
geomean                      396.2Ki        394.5Ki       -0.43%

                           │ before.log  │             after.log              │
                           │  allocs/op  │  allocs/op   vs base               │
BackwardIterator/66_kB-16    2.764k ± 0%   2.764k ± 0%   0.00% (p=0.010 n=10)
BackwardIterator/262_kB-16    616.0 ± 0%    618.0 ± 0%  +0.32% (p=0.000 n=10)
BackwardIterator/524_kB-16    255.0 ± 0%    255.0 ± 0%       ~ (p=0.211 n=10)
geomean                       757.2         758.0       +0.11%

resolved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant