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: gauge continuity #52

Merged
merged 1 commit into from
May 23, 2023
Merged

fix: gauge continuity #52

merged 1 commit into from
May 23, 2023

Conversation

fracasula
Copy link
Collaborator

@fracasula fracasula commented May 23, 2023

Description

We must not reset the gauge value after an observation is taken, otherwise if no value is written before the next observation, we'll end up with a gap. Instead we should be showing the last value since it has not changed:

image

TheotelGauge.getValue() method is called inside the OTel RegisterCallback only where we have the following:

_, err = meter.RegisterCallback(func(ctx context.Context, o metric.Observer) error {
	if value := og.getValue(); value != nil {
		o.ObserveFloat64(g, cast.ToFloat64(value), og.attributes...)
	}
	return nil
}, g)

Notion Ticket

< Notion Link >

Security

  • The code changed/added as part of this pull request won't create any security issues with how the software is being used.

@codecov
Copy link

codecov bot commented May 23, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.05 ⚠️

Comparison is base (458288a) 77.54% compared to head (209b9bb) 77.50%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #52      +/-   ##
==========================================
- Coverage   77.54%   77.50%   -0.05%     
==========================================
  Files          48       48              
  Lines        3135     3129       -6     
==========================================
- Hits         2431     2425       -6     
  Misses        581      581              
  Partials      123      123              
Impacted Files Coverage Δ
stats/otel_measurement.go 73.80% <100.00%> (-3.28%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@fracasula fracasula merged commit 698f566 into main May 23, 2023
@fracasula fracasula deleted the fix.gaugeContinuity branch May 23, 2023 13:46
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.

3 participants