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

Fix promtail scrape config job name validation #7402

Merged
merged 2 commits into from
Oct 12, 2022
Merged

Fix promtail scrape config job name validation #7402

merged 2 commits into from
Oct 12, 2022

Conversation

vijal-patel
Copy link
Contributor

@vijal-patel vijal-patel commented Oct 12, 2022

What this PR does / why we need it:
The current promtail scrapeConfig jobName validation only sanitizes empty spaces. If special characters are introduced it causes a panic. The implemented fix uses the label sanitzer in the strutil package.

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

Special notes for your reviewer:
Not sure if I described things correctly in the PR title, I'm very new to Loki in general.

Checklist

  • Reviewed the CONTRIBUTING.md guide
  • Documentation added
  • Tests updated
  • CHANGELOG.md updated
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

@vijal-patel vijal-patel requested a review from a team as a code owner October 12, 2022 19:57
@CLAassistant
Copy link

CLAassistant commented Oct 12, 2022

CLA assistant check
All committers have signed the CLA.

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

LGTM! One small nit

clients/pkg/promtail/targets/lokipush/pushtargetmanager.go Outdated Show resolved Hide resolved
Co-authored-by: Danny Kopping <dannykopping@gmail.com>
Copy link
Contributor

@dannykopping dannykopping left a comment

Choose a reason for hiding this comment

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

Thanks for this @vijal-patel! Appreciate the use of the Prometheus library here to sanitise this correctly

@grafanabot
Copy link
Collaborator

./tools/diff_coverage.sh ../loki-main/test_results.txt test_results.txt ingester,distributor,querier,querier/queryrange,iter,storage,chunkenc,logql,loki

Change in test coverage per package. Green indicates 0 or positive change, red indicates that test coverage for a package fell.

+           ingester	0.1%
+        distributor	0%
+            querier	0%
+ querier/queryrange	0.1%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
+               loki	0%

@dannykopping dannykopping merged commit 5f7543d into grafana:main Oct 12, 2022
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
changhyuni pushed a commit to changhyuni/loki that referenced this pull request Nov 8, 2022
Abuelodelanada pushed a commit to canonical/loki that referenced this pull request Dec 1, 2022
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.

Scape config job_name is used without sanitisation for metric name, causing panic
4 participants