Skip to content

Commit

Permalink
fixup: fix go.mod/go.sum, linter errors, and misc deprecations
Browse files Browse the repository at this point in the history
- Adds go.mod replace directives for the specific revision of
  prometheus/client_golang that we need (until they release a version
  with our exemplar changes).
- Fixes a few missed deprecations re: pdata, etc.
- Fixes some linting complaints
  • Loading branch information
ahayworth committed Jun 23, 2022
1 parent ea45a2e commit f0611ea
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 225 deletions.
2 changes: 2 additions & 0 deletions cmd/configschema/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -883,3 +883,5 @@ exclude github.com/StackExchange/wmi v1.2.0

// see https://github.com/distribution/distribution/issues/3590
exclude github.com/docker/distribution v2.8.0+incompatible

replace github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.12.2-0.20220318110013-3bc8f2c651ff
39 changes: 2 additions & 37 deletions cmd/configschema/go.sum

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

17 changes: 9 additions & 8 deletions exporter/prometheusexporter/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ func TestConvertInvalidMetric(t *testing.T) {

func TestConvertDoubleHistogramExemplar(t *testing.T) {
// initialize empty histogram
metric := pdata.NewMetric()
metric.SetDataType(pdata.MetricDataTypeHistogram)
metric := pmetric.NewMetric()
metric.SetDataType(pmetric.MetricDataTypeHistogram)
metric.SetName("test_metric")
metric.SetDescription("this is test metric")
metric.SetUnit("T")
Expand All @@ -108,9 +108,9 @@ func TestConvertDoubleHistogramExemplar(t *testing.T) {
hd := metric.Histogram().DataPoints().AppendEmpty()

bounds := []float64{5, 25, 90}
hd.SetExplicitBounds(bounds)
hd.SetMExplicitBounds(bounds)
bc := []uint64{2, 35, 70}
hd.SetBucketCounts(bc)
hd.SetMBucketCounts(bc)

exemplarTs, _ := time.Parse("unix", "Mon Jan _2 15:04:05 MST 2006")
exemplars := []prometheus.Exemplar{
Expand Down Expand Up @@ -138,19 +138,20 @@ func TestConvertDoubleHistogramExemplar(t *testing.T) {
for k, v := range e.Labels {
pde.FilteredAttributes().InsertString(k, v)
}
pde.SetTimestamp(pdata.NewTimestampFromTime(e.Timestamp))
pde.SetTimestamp(pcommon.NewTimestampFromTime(e.Timestamp))
}

c := collector{
accumulator: &mockAccumulator{
[]pdata.Metric{metric},
[]pmetric.Metric{metric},
pcommon.NewMap(),
},
logger: zap.NewNop(),
}

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

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

Expand Down
4 changes: 3 additions & 1 deletion exporter/prometheusexporter/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ go 1.17
require (
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.53.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.53.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver v0.53.0
github.com/prometheus/client_golang v1.12.2
github.com/prometheus/client_model v0.2.0
github.com/prometheus/common v0.34.0
Expand Down Expand Up @@ -157,3 +157,5 @@ replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator
replace github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry => ../../pkg/resourcetotelemetry

replace github.com/open-telemetry/opentelemetry-collector-contrib/receiver/prometheusreceiver => ../../receiver/prometheusreceiver

replace github.com/prometheus/client_golang => github.com/prometheus/client_golang v1.12.2-0.20220318110013-3bc8f2c651ff

0 comments on commit f0611ea

Please sign in to comment.