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: Use type safe metrics struct #185

Merged
merged 6 commits into from
Aug 31, 2021
Merged

feat: Use type safe metrics struct #185

merged 6 commits into from
Aug 31, 2021

Conversation

Reasno
Copy link
Member

@Reasno Reasno commented Aug 30, 2021

Make predefinedned metrics a dedicated type rather than an interface. This gives user more type safety. See https://medium.com/@sameer_74231/go-experience-report-for-generics-google-metrics-api-b019d597aaa4

@codecov
Copy link

codecov bot commented Aug 30, 2021

Codecov Report

Merging #185 (953c579) into master (4cccba0) will increase coverage by 0.73%.
The diff coverage is 98.27%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #185      +/-   ##
==========================================
+ Coverage   80.50%   81.24%   +0.73%     
==========================================
  Files          91       93       +2     
  Lines        3273     3449     +176     
==========================================
+ Hits         2635     2802     +167     
- Misses        463      472       +9     
  Partials      175      175              
Impacted Files Coverage Δ
srvhttp/metrics.go 80.64% <83.33%> (+80.64%) ⬆️
otkafka/writer_metrics.go 97.64% <97.46%> (+2.77%) ⬆️
observability/metrics.go 100.00% <100.00%> (ø)
observability/observability.go 100.00% <100.00%> (ø)
otgorm/gorm_metrics.go 100.00% <100.00%> (ø)
otkafka/reader_metrics.go 100.00% <100.00%> (ø)
otredis/metrics.go 100.00% <100.00%> (ø)
srvgrpc/metrics.go 95.65% <100.00%> (ø)
srvgrpc/healthcheck.go 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4cccba0...953c579. Read the comment docs.

@Reasno Reasno requested a review from GGXXLL August 30, 2021 08:53
GGXXLL
GGXXLL previously approved these changes Aug 30, 2021
GGXXLL
GGXXLL previously approved these changes Aug 30, 2021
@Reasno Reasno added this to the v0.9.0 milestone Aug 30, 2021
@Reasno Reasno merged commit baa2923 into master Aug 31, 2021
@Reasno Reasno deleted the observabililty branch August 31, 2021 08:18
Reasno added a commit that referenced this pull request Aug 31, 2021
* feat: Use type safe metrics struct

* doc: add comment

* Update doc.go

* refactor: use point receivers

* test: fix tests

* test: fix tests
Reasno added a commit that referenced this pull request Aug 31, 2021
#187)

* fix(container): shutdown the modules in the reversed order of registration

* fix(container): shutdown the modules in the reversed order of registration

* feat(clihttp): limit max length a client can read from body (#186)

* feat: limit the length when read body

* fix: WithResponseLogThreshold error and add test case

* refactor(container): remove ifilter dependency. (#183)

* refactor: change how DI and container works

* docs: clarify words

* test: test the cleanup function is executed

* test: cover current behavior

* refactor: change how DI and container works

* docs: clarify words

* test: test the cleanup function is executed

* test: cover current behavior

Co-authored-by: Trock <35254251+GGXXLL@users.noreply.github.com>

* feat: make metrics struct type safe (#185)

* feat: Use type safe metrics struct

* doc: add comment

* Update doc.go

* refactor: use point receivers

* test: fix tests

* test: fix tests

* fix(container): test

Co-authored-by: Trock <35254251+GGXXLL@users.noreply.github.com>
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.

2 participants