Skip to content

Commit

Permalink
fixup: misc lint, vet complaints; gotidy; test fixes
Browse files Browse the repository at this point in the history
We needed to update expected log messages for some tests. Additionally,
there were a few linter / vet errors and we needed to run `gotidy`.
  • Loading branch information
ahayworth committed May 18, 2022
1 parent bf8e315 commit dc92f6c
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 962 deletions.
5 changes: 2 additions & 3 deletions exporter/prometheusexporter/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ func TestConvertInvalidMetric(t *testing.T) {
func TestConvertDoubleHistogramExemplar(t *testing.T) {
// initialize empty histogram
metric := pdata.NewMetric()
metric.SetDataType(pdata.MetricDataTypeHistogram)
metric.SetDataType(pmetric.MetricDataTypeHistogram)
metric.SetName("test_metric")
metric.SetDescription("this is test metric")
metric.SetUnit("T")
Expand Down Expand Up @@ -151,9 +151,8 @@ func TestConvertDoubleHistogramExemplar(t *testing.T) {
}

pbMetric, _ := c.convertDoubleHistogram(metric, pcommon.NewMap())
pbMetric, _ := c.convertDoubleHistogram(metric)
m := io_prometheus_client.Metric{}
pbMetric.Write(&m)
require.NoError(t, pbMetric.Write(&m))

buckets := m.GetHistogram().GetBucket()

Expand Down
2 changes: 1 addition & 1 deletion exporter/prometheusexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func createDefaultConfig() config.Exporter {
MetricExpiration: time.Minute * 5,
EnableOpenMetrics: false,
skipSanitizeLabel: featuregate.GetRegistry().IsEnabled(dropSanitizationGate.ID),
}
}
}

func createMetricsExporter(
Expand Down
22 changes: 0 additions & 22 deletions exporter/prometheusexporter/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions internal/coreinternal/processor/filterlog/filterlog_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,22 @@ func TestLogRecord_validateMatchesConfiguration_InvalidConfig(t *testing.T) {
{
name: "empty_property",
property: filterconfig.MatchProperties{},
errorString: `at least one of "attributes", "libraries", "resources", "log_bodies" or "log_severity_texts" field must be specified`,
errorString: `at least one of "log_names", "log_bodies", "log_severity_texts", "attributes", "libraries", "span_kinds", or "resources" field must be specified`,
},
{
name: "empty_log_bodies_and_attributes",
property: filterconfig.MatchProperties{
LogBodies: []string{},
LogSeverityTexts: []string{},
},
errorString: `at least one of "attributes", "libraries", "resources", "log_bodies" or "log_severity_texts" field must be specified`,
errorString: `at least one of "log_names", "log_bodies", "log_severity_texts", "attributes", "libraries", "span_kinds", or "resources" field must be specified`,
},
{
name: "span_properties",
property: filterconfig.MatchProperties{
SpanNames: []string{"span"},
},
errorString: "neither services nor span_names should be specified for log records",
errorString: "services, span_names, and span_kinds are not valid for log records",
},
{
name: "invalid_match_type",
Expand Down
8 changes: 4 additions & 4 deletions internal/coreinternal/processor/filterspan/filterspan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,15 +149,15 @@ func TestSpan_Matching_False(t *testing.T) {
properties: &filterconfig.MatchProperties{
Config: *createConfig(filterset.Regexp),
Attributes: []filterconfig.Attribute{},
SpanKinds: []string{pdata.SpanKindProducer.String()},
SpanKinds: []string{ptrace.SpanKindProducer.String()},
},
},
{
name: "span_kind_doesnt_match_strict",
properties: &filterconfig.MatchProperties{
Config: *createConfig(filterset.Strict),
Attributes: []filterconfig.Attribute{},
SpanKinds: []string{pdata.SpanKindProducer.String()},
SpanKinds: []string{ptrace.SpanKindProducer.String()},
},
},
}
Expand Down Expand Up @@ -239,7 +239,7 @@ func TestSpan_Matching_True(t *testing.T) {
properties: &filterconfig.MatchProperties{
Config: *createConfig(filterset.Strict),
SpanKinds: []string{
pdata.SpanKindClient.String(),
ptrace.SpanKindClient.String(),
},
Attributes: []filterconfig.Attribute{},
},
Expand All @@ -263,7 +263,7 @@ func TestSpan_Matching_True(t *testing.T) {
span.Attributes().InsertDouble("keyDouble", 3245.6)
span.Attributes().InsertBool("keyBool", true)
span.Attributes().InsertString("keyExists", "present")
span.SetKind(pdata.SpanKindClient)
span.SetKind(ptrace.SpanKindClient)
assert.NotNil(t, span)

resource := pcommon.NewResource()
Expand Down
Loading

0 comments on commit dc92f6c

Please sign in to comment.