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

[metric] #3 Reset the declared_resources metric when at a new commit [restored] #1232

Merged

Conversation

tiffanny29631
Copy link
Contributor

@tiffanny29631 tiffanny29631 commented May 22, 2024

The current OpenCensus library keeps a metric stream that is uniquely identified by commit alive even though no new values are issued.

This makes the Otel Collector metricstransform processor receives all time value when calculating the max and gives false output.

The temporary work around is to reset the stream of previous commit to 0 when parser sees new commit.

b/321875474

See the falsely closed PR #1219 for context.

@google-oss-prow google-oss-prow bot requested review from karlkfi and sdowell May 22, 2024 21:38
@tiffanny29631 tiffanny29631 force-pushed the opencensus-otel branch 2 times, most recently from a770ea3 to 55a2b91 Compare May 23, 2024 18:48
@tiffanny29631
Copy link
Contributor Author

Context of using rate() instead of present_over_time() in PromQL: prometheus/prometheus#8255 the first proposal of adding a present_over_time() function to represent if a timeserie exists in the time frame.

In our case the error metrics (i.e. resource_fights_total) will always exist even though the value of it does not change when no resource fights are happening, which will make the present_over_time() always returning 1 http://screen/4wdqXrJqAUFP7PZ.

Using rate() instead can give us an idea whether a fight was recorded within the queried time frame - if no fights are recorded, the record rate should go back to 0.

pkg/metrics/otel.go Outdated Show resolved Hide resolved
pkg/metrics/otel.go Outdated Show resolved Hide resolved
pkg/metrics/metrics.go Outdated Show resolved Hide resolved
pkg/metrics/record.go Outdated Show resolved Hide resolved
pkg/parse/run.go Outdated Show resolved Hide resolved
pkg/declared/resources.go Outdated Show resolved Hide resolved
@tiffanny29631 tiffanny29631 changed the title Reset the declared_resources metric when at a new commit [restored] [metric] #3 Reset the declared_resources metric when at a new commit [restored] May 28, 2024
@tiffanny29631 tiffanny29631 changed the title [metric] #3 Reset the declared_resources metric when at a new commit [restored] [metric] #2 Reset the declared_resources metric when at a new commit [restored] May 28, 2024
@tiffanny29631 tiffanny29631 changed the title [metric] #2 Reset the declared_resources metric when at a new commit [restored] [metric] #3 Reset the declared_resources metric when at a new commit [restored] May 29, 2024
@tiffanny29631 tiffanny29631 force-pushed the opencensus-otel branch 3 times, most recently from 1add856 to 75eb21f Compare June 3, 2024 20:47
@google-oss-prow google-oss-prow bot added size/L and removed size/XL labels Jun 3, 2024
@tiffanny29631
Copy link
Contributor Author

/retest-required

pkg/declared/resources.go Outdated Show resolved Hide resolved
pkg/declared/resources.go Outdated Show resolved Hide resolved
pkg/declared/resources.go Outdated Show resolved Hide resolved
@tiffanny29631
Copy link
Contributor Author

/retest-required

metrics.RecordDeclaredResources(ctx, r.previousCommit, 0)
}

r.mutex.Lock()
Copy link
Contributor

Choose a reason for hiding this comment

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

just move these to the top of the method:
r.mutex.Lock()
defer r.mutex.Unlock()

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm yeah just did and tried with the same failing test, still not helping. TestDontDeleteAllNamespaces

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh it's the order of deleteNS and update members. This time it should work.

…mit updates

The current OpenCensus library keeps a metric stream that is uniquely identified by commit alive even though no new values are issued.

This makes the Otel Collector metricstransform processor receives all time value when calculating the max and gives false output.

The temporary work around is to reset the stream of previous commit to 0 when parser sees new commit.

b/321875474
@tiffanny29631
Copy link
Contributor Author

/retest-required

Copy link
Contributor

@karlkfi karlkfi left a comment

Choose a reason for hiding this comment

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

/lgtm

Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: karlkfi

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 6163281 into GoogleContainerTools:main Jun 7, 2024
6 checks passed
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 7, 2024
…mit updates (GoogleContainerTools#1232)

The current OpenCensus library keeps a metric stream that is uniquely identified by commit alive even though no new values are issued.

This makes the Otel Collector metricstransform processor receives all time value when calculating the max and gives false output.

The temporary work around is to reset the stream of previous commit to 0 when parser sees new commit.

b/321875474
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 10, 2024
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 11, 2024
The fix GoogleContainerTools#1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 11, 2024
The fix GoogleContainerTools#1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
google-oss-prow bot pushed a commit that referenced this pull request Jun 11, 2024
The fix #1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 12, 2024
…mit updates (GoogleContainerTools#1232)

The current OpenCensus library keeps a metric stream that is uniquely identified by commit alive even though no new values are issued.

This makes the Otel Collector metricstransform processor receives all time value when calculating the max and gives false output.

The temporary work around is to reset the stream of previous commit to 0 when parser sees new commit.

b/321875474
tiffanny29631 added a commit to tiffanny29631/kpt-config-sync that referenced this pull request Jun 12, 2024
The fix GoogleContainerTools#1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
google-oss-prow bot pushed a commit that referenced this pull request Jun 12, 2024
…ix (#1232) (#1254)

* [metric] #3 Reset declared_resource to 0 when commit updates (#1232)

The current OpenCensus library keeps a metric stream that is uniquely identified by commit alive even though no new values are issued.

This makes the Otel Collector metricstransform processor receives all time value when calculating the max and gives false output.

The temporary work around is to reset the stream of previous commit to 0 when parser sees new commit.

b/321875474

* Use default timeout for metric value check (#1264)

* test: Only check declared_resources metric (#1268)

The fix #1232 only affects declared_resources from Config Sync.

The metric from RG controller may take longer to be ready. Skip checking for those target values for now.
@tiffanny29631 tiffanny29631 deleted the opencensus-otel branch June 18, 2024 20:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants