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

Fix prometheusexporter droping the OTEL resource labels #2899

Merged
Prev Previous commit
Next Next commit
fix: missing test case for exporterhelper.NewMetricsExporter error
  • Loading branch information
krak3n committed Apr 8, 2021
commit d7f10761020ef6e048192c6c4fe29d166b9d3270
16 changes: 16 additions & 0 deletions exporter/prometheusexporter/factory_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ func TestCreateMetricsExporter(t *testing.T) {
require.Equal(t, errBlankPrometheusAddress, err)
require.Nil(t, exp)
}

func TestCreateMetricsExporterExportHelperError(t *testing.T) {
cfg, ok := createDefaultConfig().(*Config)
require.True(t, ok)

cfg.Endpoint = "http://localhost:8889"

// Should give us an exporterhelper.errNilLogger
exp, err := createMetricsExporter(
context.Background(),
component.ExporterCreateParams{Logger: nil},
cfg)

assert.Nil(t, exp)
assert.Error(t, err)
}