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

Register all available Go metrics #6962

Merged
merged 1 commit into from
Aug 24, 2022

Conversation

dannykopping
Copy link
Contributor

What this PR does / why we need it:
In the previous PR #6957 I accidentally removed about 88 metrics due to the resetting of prometheus.Default{Gatherer,Registerer}.

This new PR simplifies the implementation by using the default registerer but unregistering the default Go collector (which contains only a stripped-down list of metrics from the go runtime) with a collector which contains all available metrics.

Which issue(s) this PR fixes:
N/A

Special notes for your reviewer:
The following metrics have been added:

go_gc_cycles_automatic_gc_cycles_total
go_gc_cycles_forced_gc_cycles_total
go_gc_cycles_total_gc_cycles_total
go_gc_heap_allocs_by_size_bytes_bucket
go_gc_heap_allocs_by_size_bytes_count
go_gc_heap_allocs_by_size_bytes_sum
go_gc_heap_allocs_bytes_total
go_gc_heap_allocs_objects_total
go_gc_heap_frees_by_size_bytes_bucket
go_gc_heap_frees_by_size_bytes_count
go_gc_heap_frees_by_size_bytes_sum
go_gc_heap_frees_bytes_total
go_gc_heap_frees_objects_total
go_gc_heap_goal_bytes
go_gc_heap_objects_objects
go_gc_heap_tiny_allocs_objects_total
go_gc_pauses_seconds_bucket
go_gc_pauses_seconds_count
go_gc_pauses_seconds_sum
go_memory_classes_heap_free_bytes
go_memory_classes_heap_objects_bytes
go_memory_classes_heap_released_bytes
go_memory_classes_heap_stacks_bytes
go_memory_classes_heap_unused_bytes
go_memory_classes_metadata_mcache_free_bytes
go_memory_classes_metadata_mcache_inuse_bytes
go_memory_classes_metadata_mspan_free_bytes
go_memory_classes_metadata_mspan_inuse_bytes
go_memory_classes_metadata_other_bytes
go_memory_classes_os_stacks_bytes
go_memory_classes_other_bytes
go_memory_classes_profiling_buckets_bytes
go_memory_classes_total_bytes
go_sched_goroutines_goroutines
go_sched_latencies_seconds_bucket
go_sched_latencies_seconds_count
go_sched_latencies_seconds_sum

And I have validated that no other metrics have been removed.

Checklist

  • Documentation added
  • Tests updated
  • Is this an important fix or new feature? Add an entry in the CHANGELOG.md.
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/upgrading/_index.md

Adding all available metrics from Go

Signed-off-by: Danny Kopping <[email protected]>
@dannykopping dannykopping changed the title Adding all available Go metrics Register all available Go metrics Aug 24, 2022
@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%
+               iter	0%
+            storage	0%
+           chunkenc	0%
+              logql	0%
-               loki	-0.1%

@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.1%

@dannykopping dannykopping marked this pull request as ready for review August 24, 2022 07:03
@dannykopping dannykopping requested a review from a team as a code owner August 24, 2022 07:03
Copy link
Contributor

@MichelHollands MichelHollands left a comment

Choose a reason for hiding this comment

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

Nice, a lot simpler. LGTM

@dannykopping dannykopping merged commit 449dd81 into grafana:main Aug 24, 2022
@dannykopping dannykopping deleted the dannykopping/metrics-fix branch August 24, 2022 07:29
dannykopping pushed a commit that referenced this pull request Aug 24, 2022
Adding all available metrics from Go

Signed-off-by: Danny Kopping <[email protected]>

Signed-off-by: Danny Kopping <[email protected]>
@dannykopping dannykopping added the backport release-2.6.x Tag a PR with this label to create a PR which cherry pics it into the release-2.6.x branch label Aug 29, 2022
@grafanabot
Copy link
Collaborator

The backport to release-2.6.x 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-6962-to-release-2.6.x origin/release-2.6.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x 449dd819810a4b04731e34efbd202af9914f0e55
# Push it to GitHub
git push --set-upstream origin backport-6962-to-release-2.6.x
git switch main
# Remove the local backport branch
git branch -D backport-6962-to-release-2.6.x

Then, create a pull request where the base branch is release-2.6.x and the compare/head branch is backport-6962-to-release-2.6.x.

dannykopping pushed a commit that referenced this pull request Aug 29, 2022
Adding all available metrics from Go

Signed-off-by: Danny Kopping <[email protected]>

Signed-off-by: Danny Kopping <[email protected]>
lxwzy pushed a commit to lxwzy/loki that referenced this pull request Nov 7, 2022
…grafana#6962)

Adding all available metrics from Go

Signed-off-by: Danny Kopping <[email protected]>

Signed-off-by: Danny Kopping <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport release-2.6.x Tag a PR with this label to create a PR which cherry pics it into the release-2.6.x branch size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants