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

[Prometheus Exporter] Fix Issue 6228: Flaky End to End Test #6697

Merged

Conversation

PaurushGarg
Copy link
Member

Description:

Current design has buffer capacity of 1 for waitForScrapes channel, and may not be enough for scrape_interval of 2ms.
After ensuring that receiver has scraped target from test server 8 times; and before the GET request is made to fetch metrics from the exposed Prometheus exporter end points -- the Prometheus Receiver keeps trying to scrape metrics and when it does not get any response (as response is blocked because channel has only 1 buffer capacity against 2ms scrape_interval) Prometheus Receiver generates failed scrapes (staleNaN and so on) - and that's why this test is flaky.
So solution is to avoid generation of failed scrapes by ensuring that there is always a response to Prometheus Receiver GET requests from the test server.

  • Added non-blocking serve for dropWizard.

Link to tracking Issue:
Issue #6228

cc @alolita @Aneurysm9

@@ -106,7 +107,7 @@ func TestEndToEndSummarySupport(t *testing.T) {
PrometheusConfig: receiverConfig,
ReceiverSettings: config.NewReceiverSettings(config.NewComponentID("prometheus")),
}
// 3.5 Create the Prometheus receiver and pass in the preivously created Prometheus exporter.
// 3.5 Create the Prometheus receiver and pass in the previously created Prometheus exporter.
Copy link
Contributor

Choose a reason for hiding this comment

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

Any idea why we need a prometheus receiver here? We don't seem to do anything with it, and the extra calls it makes seem disruptive to the rest of the test.

Copy link
Member

Choose a reason for hiding this comment

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

The receiver handles scraping the mocked exposition and converting it to pdata, then passing it to the exporter.

for i := 0; i < 8; i++ {
<-waitForScrape
}
// 4. Scrape from the Prometheus receiver to ensure that we export summary metrics
Copy link
Contributor

Choose a reason for hiding this comment

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

We are scraping from the prometheus exporter, not receiver.

Copy link
Member

Choose a reason for hiding this comment

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

The scrapes come from the receiver. That is what the wg.Wait() is waiting for. Once the receiver has scraped the target enough times then the wait group is resolved.

Copy link
Contributor

@dashpole dashpole left a comment

Choose a reason for hiding this comment

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

got it, thanks

@Aneurysm9 Aneurysm9 added the ready to merge Code review completed; ready to merge by maintainers label Dec 10, 2021
@bogdandrutu bogdandrutu merged commit 420ed6a into open-telemetry:main Dec 10, 2021
PaurushGarg referenced this pull request in open-o11y/opentelemetry-collector-contrib Dec 11, 2021
* non-blocking serve for drop wizard

* Removing previous typos

* Resolving feedback comments
PaurushGarg referenced this pull request in open-o11y/opentelemetry-collector-contrib Dec 11, 2021
* non-blocking serve for drop wizard

* Removing previous typos

* Resolving feedback comments
PaurushGarg referenced this pull request in open-o11y/opentelemetry-collector-contrib Dec 11, 2021
* non-blocking serve for drop wizard

* Removing previous typos

* Resolving feedback comments
PaurushGarg referenced this pull request in open-o11y/opentelemetry-collector-contrib Dec 14, 2021
* non-blocking serve for drop wizard

* Removing previous typos

* Resolving feedback comments
@PaurushGarg PaurushGarg deleted the fix-prom-exporter-issue-6228 branch December 18, 2021 04:55
povilasv referenced this pull request in coralogix/opentelemetry-collector-contrib Dec 19, 2022
Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants