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 9, 2022
1 parent ff4ce14 commit 3436c45
Show file tree
Hide file tree
Showing 3 changed files with 18 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 @@ -73,7 +73,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
11 changes: 11 additions & 0 deletions obsreport/obsreporttest/otelprometheuschecker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,14 @@ func TestPromChecker(t *testing.T) {
pc, err := newStubPromChecker()
require.NoError(t, err)

<<<<<<< HEAD
receiver := component.NewID("fakeReceiver")
exporter := component.NewID("fakeExporter")
=======
scraper := config.NewComponentID("fakeScraper")
receiver := config.NewComponentID("fakeReceiver")
exporter := config.NewComponentID("fakeExporter")
>>>>>>> bdc7135b (fix typo add testing for checkScraperMetrics)
transport := "fakeTransport"

assert.NoError(t,
Expand Down Expand Up @@ -76,6 +82,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 3436c45

Please sign in to comment.