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

feat: Improve pattern ingester tracing #14707

Merged
merged 6 commits into from
Nov 1, 2024

Conversation

trevorwhitney
Copy link
Collaborator

What this PR does / why we need it:

We had to turn off aggregated metrics in a prod cluster because the service_name label being used for __aggregated_metric__ had crazy cardinality, it was some huge JSON blob. This PR adds some more tracing and log signals to the aggregated metrics path through the pattern ingester so we can debug what's going on.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

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

@loki-gh-app
Copy link
Contributor

loki-gh-app bot commented Nov 1, 2024

This PR must be merged before a backport PR will be created.

Copy link
Contributor

@benclive benclive left a comment

Choose a reason for hiding this comment

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

LGTM. I added a couple of small suggestions but I don't think the impact is large so I'm happy to approve to unblock.

@@ -202,6 +213,13 @@ func (p *Push) buildPayload() ([]byte, error) {

payload = snappy.Encode(nil, payload)

sp.LogKV(
"event", "build aggregated metrics payload",
"services", strings.Join(services, ","),
Copy link
Contributor

Choose a reason for hiding this comment

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

Should the "services" be limited somehow? I'm not expecting a lot but just in case there is a large number of services we're trying to attach to a span.


sp.LogKV(
"event", "forwarded push request to pattern ingester",
"labels", strings.Join(labels, ", "),
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here, it shouldn't be big but it might be worth checking the length of this just in case?

@pull-request-size pull-request-size bot added size/L and removed size/M labels Nov 1, 2024
@trevorwhitney trevorwhitney force-pushed the improve-pattern-ingester-tracing branch from a7e2ff7 to 7cd3f32 Compare November 1, 2024 17:14
@trevorwhitney trevorwhitney merged commit 80aec25 into main Nov 1, 2024
59 checks passed
@trevorwhitney trevorwhitney deleted the improve-pattern-ingester-tracing branch November 1, 2024 17:23
@loki-gh-app
Copy link
Contributor

loki-gh-app bot commented Nov 1, 2024

The backport to k226 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new branch
git switch --create backport-14707-to-k226 origin/k226
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 80aec2548203957dbb834ba69e6d734d9054416d

When the conflicts are resolved, stage and commit the changes:

git add . && git cherry-pick --continue

If you have the GitHub CLI installed:

# Push the branch to GitHub:
git push --set-upstream origin backport-14707-to-k226
# Create the PR body template
PR_BODY=$(gh pr view 14707 --json body --template 'Backport 80aec2548203957dbb834ba69e6d734d9054416d from #14707{{ "\n\n---\n\n" }}{{ index . "body" }}')
# Create the PR on GitHub
echo "${PR_BODY}" | gh pr create --title 'feat: Improve pattern ingester tracing (backport k226)' --body-file - --label 'size/L' --label 'product-approved' --label 'backport' --base k226 --milestone k226 --web

Or, if you don't have the GitHub CLI installed (we recommend you install it!):

# Push the branch to GitHub:
git push --set-upstream origin backport-14707-to-k226

# Create a pull request where the `base` branch is `k226` and the `compare`/`head` branch is `backport-14707-to-k226`.

# Remove the local backport branch
git switch main
git branch -D backport-14707-to-k226

trevorwhitney added a commit that referenced this pull request Nov 1, 2024
trevorwhitney added a commit that referenced this pull request Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants