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(metrics): move to otel abstractions for metrics recording #1147

Merged
merged 8 commits into from
Nov 21, 2022

Conversation

GeorgeMac
Copy link
Contributor

This updates the three existing packages which record prom metrics.
It updates them to record their metrics via the otel abstractions.

The packages are:

  • server
  • cache
  • storage (database/sql)

The result is some slight adjustments to how the metrics are named.
Most notable is the database stats ones.
Because it turns out, otelsql package we use for tracing has all the instruments for metrics too.
Using this package changes the names to be db_sql_connection_ and db_sql_latency_ prefixed.
They make some good choices regarding metric types. Even rolling latency up into a histogram.

Screenshot 2022-11-17 at 14 29 50

@GeorgeMac GeorgeMac requested a review from a team as a code owner November 17, 2022 15:36
@codecov-commenter
Copy link

codecov-commenter commented Nov 17, 2022

Codecov Report

Merging #1147 (e13fdbf) into main (5264927) will increase coverage by 0.60%.
The diff coverage is 76.47%.

❗ Current head e13fdbf differs from pull request most recent head 5eaa1e7. Consider uploading reports for the commit 5eaa1e7 to get more accurate results

@@            Coverage Diff             @@
##             main    #1147      +/-   ##
==========================================
+ Coverage   79.31%   79.91%   +0.60%     
==========================================
  Files          36       35       -1     
  Lines        2562     2435     -127     
==========================================
- Hits         2032     1946      -86     
+ Misses        434      393      -41     
  Partials       96       96              
Impacted Files Coverage Δ
internal/server/cache/redis/cache.go 63.63% <42.85%> (-11.98%) ⬇️
internal/server/cache/memory/cache.go 100.00% <100.00%> (ø)
internal/server/middleware.go 61.21% <100.00%> (ø)
internal/storage/sql/db.go 90.90% <100.00%> (+0.21%) ⬆️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Collaborator

@markphelps markphelps left a comment

Choose a reason for hiding this comment

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

lgtm, would you mind adding a section to the CHANGELOG under ##unreleased about the metric renaming so that we don't forget at release time?

var (
// Hit is a counter for cache hits.
Hit = metrics.MustSyncInt64().
Counter(
Copy link
Collaborator

Choose a reason for hiding this comment

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

i like this pattern much better than what we were previously having to do

@GeorgeMac GeorgeMac merged commit 3bd1975 into main Nov 21, 2022
@GeorgeMac GeorgeMac deleted the gm/otel-metrics branch November 21, 2022 13:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants