Skip to content

Commit

Permalink
fix typo add testing for checkScraperMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
moh-osman3 committed Nov 3, 2022
1 parent 63bb239 commit bdc7135
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion obsreport/obsreport_scraper.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func NewScraper(cfg ScraperSettings) *Scraper {
return scr
}

// MustNewReceiver creates a new Scraper.
// MustNewScraper creates a new Scraper.
func MustNewScraper(cfg ScraperSettings) *Scraper {
scr, err := newScraper(cfg, featuregate.GetRegistry())
if err != nil {
Expand Down
6 changes: 6 additions & 0 deletions obsreport/obsreporttest/otelprometheuschecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ func TestPromChecker(t *testing.T) {
pc, err := newStubPromChecker()
require.NoError(t, err)

scraper := config.NewComponentID("fakeScraper")
receiver := config.NewComponentID("fakeReceiver")
exporter := config.NewComponentID("fakeExporter")
transport := "fakeTransport"
Expand Down Expand Up @@ -76,6 +77,11 @@ func TestPromChecker(t *testing.T) {
"invalid metric type should return error",
)

assert.NoError(t,
pc.checkScraperMetrics(receiver, scraper, 7, 41),
"metrics from Scraper Metrics should be valid",
)

assert.NoError(t,
pc.checkReceiverTraces(receiver, transport, 42, 13),
"metrics from Receiver Traces should be valid",
Expand Down
6 changes: 6 additions & 0 deletions obsreport/obsreporttest/testdata/prometheus_response
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ receiver_refused_metric_points{receiver="fakeReceiver",transport="fakeTransport"
# HELP receiver_refused_spans Number of spans that could not be pushed into the pipeline.
# TYPE receiver_refused_spans counter
receiver_refused_spans{receiver="fakeReceiver",transport="fakeTransport"} 13
# HELP scraper_scraped_metric_points Number of metric points successfully scraped.
# TYPE scraper_scraped_metric_points counter
scraper_scraped_metric_points{receiver="fakeReceiver",scraper="fakeScraper"} 7
# HELP scraper_errored_metric_points Number of metric points that were unable to be scraped.
# TYPE scraper_errored_metric_points counter
scraper_errored_metric_points{receiver="fakeReceiver",scraper="fakeScraper"} 41
# HELP gauge_metric A simple gauge metric
# TYPE gauge_metric gauge
gauge_metric 49

0 comments on commit bdc7135

Please sign in to comment.