Skip to content

Try fix TestMetricsExport #2088

Merged
knative-prow-robot merged 1 commit into
knative:mainfrom
skonto:try_fix_metrics_export
Apr 19, 2021
Merged

Try fix TestMetricsExport #2088
knative-prow-robot merged 1 commit into
knative:mainfrom
skonto:try_fix_metrics_export

Conversation

@skonto
Copy link
Copy Markdown
Contributor

@skonto skonto commented Apr 8, 2021

TestMetricsExport creates a lot of failures on CI lately. Here is a case where exporter never got updated. This means most likely that a previous test already had the backend set as expected but the port was different than the one expected later on.
I guess this happens only in tests and #1672 is not fixed.
This fix makes logic about prometheus reconfiguration correct for testing purposes.

/cc @evankanderson

@google-cla google-cla Bot added the cla: yes Indicates the PR's author has signed the CLA. label Apr 8, 2021
@knative-prow-robot knative-prow-robot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label Apr 8, 2021
Comment thread metrics/exporter.go
if newConfig.backendDestination == prometheus {
return newConfig.prometheusHost != cc.prometheusHost || newConfig.prometheusPort != cc.prometheusPort
}

Copy link
Copy Markdown
Contributor Author

@skonto skonto Apr 8, 2021

Choose a reason for hiding this comment

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

I am wondering why we didn't have this here before? Probably it is because we dont allow so far to change the host and port, but it does not hurt anything here I guess since our observability cm does not expose it anyway.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if all the effort to avoid reloading the config is too clever by half, but this seems like a good fix for now.

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 8, 2021

Codecov Report

Merging #2088 (980c668) into main (952fdd9) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2088      +/-   ##
==========================================
- Coverage   67.36%   67.31%   -0.06%     
==========================================
  Files         215      215              
  Lines        9111     9092      -19     
==========================================
- Hits         6138     6120      -18     
+ Misses       2698     2697       -1     
  Partials      275      275              
Impacted Files Coverage Δ
metrics/exporter.go 84.61% <100.00%> (+0.34%) ⬆️
injection/config.go 0.00% <0.00%> (ø)
reconciler/filter.go 100.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 952fdd9...980c668. Read the comment docs.

@skonto
Copy link
Copy Markdown
Contributor Author

skonto commented Apr 8, 2021

@markusthoemmes pls review.

@skonto
Copy link
Copy Markdown
Contributor Author

skonto commented Apr 18, 2021

@evankanderson pls review.

@skonto
Copy link
Copy Markdown
Contributor Author

skonto commented Apr 18, 2021

/assign @evankanderson

Copy link
Copy Markdown
Contributor

@n3wscott n3wscott left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Apr 19, 2021
Copy link
Copy Markdown
Member

@evankanderson evankanderson left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

Comment thread metrics/exporter.go
if newConfig.backendDestination == prometheus {
return newConfig.prometheusHost != cc.prometheusHost || newConfig.prometheusPort != cc.prometheusPort
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I wonder if all the effort to avoid reloading the config is too clever by half, but this seems like a good fix for now.

@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: evankanderson, n3wscott

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

The pull request process is described here

Details 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

@markusthoemmes
Copy link
Copy Markdown
Contributor

failing test seems related. It's the test that's supposed to be fixed, I guess?

@evankanderson
Copy link
Copy Markdown
Member

The failing test is in the OpenCensus path, so it's not directly related to this PR. It looks like maybe we missed an export RPC in that test run.

@skonto
Copy link
Copy Markdown
Contributor Author

skonto commented Apr 19, 2021

@evankanderson The failing path is due to the timeout where we dont get any records. Prometheus has a 10sec delay for the endpoint to be ready. Maybe if we are more generous to opencensus this will not happen (assuming there is no race there or some bug at the opencensus side)..

@skonto
Copy link
Copy Markdown
Contributor Author

skonto commented Apr 19, 2021

/retest

@knative-prow-robot knative-prow-robot merged commit 942c621 into knative:main Apr 19, 2021
@evankanderson
Copy link
Copy Markdown
Member

The last time time I fixed this, I discovered that we were using the first four reports, rather than waiting for four different series. I'm not sure what's happened in this case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants