Skip to content
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

Support metrics.go statistics on Loki labels and series API as well. #4854

Closed
wants to merge 1 commit into from

Conversation

kavirajk
Copy link
Contributor

@kavirajk kavirajk commented Dec 1, 2021

What this PR does / why we need it:
We use metrics.go (a convention) to record some useful statistics about each of the instance and range queries.

So that we can query something like
{foo="bar"}|= "metrics.go" |logfmt|latency=slow

Where latency comes from statistics recorded in pkg/logql/metric.go.

This PR add support those experience for series and labels API as well.

Examples:

  1. Labels API
curl -G -s  "http://127.0.0.1:3100/loki/api/v1/label/foo/values"

Generates following log lines via metrics.go

caller=metrics.go:146 org_id=fake latency=fast query_type=labels length=1h0m0s duration=3.07902ms status=200 label=foo throughput=0B total_bytes=0B
  1. Series API
curl -G -s  "http://127.0.0.1:3100/loki/api/v1/series" --data-urlencode 'match[]={app="loki"}'

Generates following log lines via metrics.go

level=info ts=2021-12-01T16:06:59.002407Z caller=metrics.go:189 org_id=fake latency=fast query_type=series length=1h0m0s duration=2.773064ms status=200 match="{app=\"loki\"}" throughput=0B total_bytes=0B

Which issue(s) this PR fixes:
Fixes #4503

Special notes for your reviewer:

Checklist

  • Documentation added
  • Tests updated
  • Add an entry in the CHANGELOG.md about the changes.

@kavirajk kavirajk changed the title [WIP] Support metrics.go statistics on Loki labels and series API as well. Support metrics.go statistics on Loki labels and series API as well. Dec 1, 2021
Hack into make it working for both series and labels API
@kavirajk kavirajk force-pushed the improve-metricsgo-labels-series-query branch from 11ee391 to 12c2fc5 Compare December 1, 2021 16:27
@stale
Copy link

stale bot commented Jan 8, 2022

Hi! This issue has been automatically marked as stale because it has not had any
activity in the past 30 days.

We use a stalebot among other tools to help manage the state of issues in this project.
A stalebot can be very useful in closing issues in a number of cases; the most common
is closing issues or PRs where the original reporter has not responded.

Stalebots are also emotionless and cruel and can close issues which are still very relevant.

If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry.

We regularly sort for closed issues which have a stale label sorted by thumbs up.

We may also:

  • Mark issues as revivable if we think it's a valid issue but isn't something we are likely
    to prioritize in the future (the issue will still remain closed).
  • Add a keepalive label to silence the stalebot if the issue is very common/popular/important.

We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task,
our sincere apologies if you find yourself at the mercy of the stalebot.

@stale stale bot added the stale A stale issue or PR that will automatically be closed. label Jan 8, 2022
@kavirajk kavirajk added keepalive An issue or PR that will be kept alive and never marked as stale. and removed stale A stale issue or PR that will automatically be closed. labels Jan 26, 2022
@kavirajk
Copy link
Contributor Author

closing in regards to #5971

@kavirajk kavirajk closed this Apr 21, 2022
@DylanGuedes DylanGuedes deleted the improve-metricsgo-labels-series-query branch February 24, 2023 21:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive An issue or PR that will be kept alive and never marked as stale. size/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

We should log labels and series API in the frontend.
1 participant