Skip to content

Commit

Permalink
Merge pull request #1709 from Shopify/ahayworth/merge-shopify-changes…
Browse files Browse the repository at this point in the history
…-v0.53.0

Merge shopify changes onto v0.53.0
  • Loading branch information
tanner-bruce committed Jun 27, 2022
2 parents 1cbacd8 + f0611ea commit 8946486
Show file tree
Hide file tree
Showing 27 changed files with 529 additions and 420 deletions.
344 changes: 176 additions & 168 deletions .github/dependabot.yml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Makefile
Expand Up @@ -158,23 +158,23 @@ gendependabot:
@echo " - package-ecosystem: \"github-actions\"" >> ${DEPENDABOT_PATH}
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
@echo " schedule:" >> ${DEPENDABOT_PATH}
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
@echo "Add entry for \"/\" docker"
@echo " - package-ecosystem: \"docker\"" >> ${DEPENDABOT_PATH}
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
@echo " schedule:" >> ${DEPENDABOT_PATH}
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
@echo "Add entry for \"/\" gomod"
@echo " - package-ecosystem: \"gomod\"" >> ${DEPENDABOT_PATH}
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
@echo " schedule:" >> ${DEPENDABOT_PATH}
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
@set -e; for dir in $(NONROOT_MODS); do \
echo "Add entry for \"$${dir:1}\""; \
echo " - package-ecosystem: \"gomod\"" >> ${DEPENDABOT_PATH}; \
echo " directory: \"$${dir:1}\"" >> ${DEPENDABOT_PATH}; \
echo " schedule:" >> ${DEPENDABOT_PATH}; \
echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}; \
echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}; \
done

# Define a delegation target for each module
Expand Down
6 changes: 4 additions & 2 deletions cmd/configschema/go.mod
Expand Up @@ -7,7 +7,7 @@ require (
github.com/google/uuid v1.3.0
github.com/open-telemetry/opentelemetry-collector-contrib v0.53.0
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.53.0
github.com/stretchr/testify v1.7.2
github.com/stretchr/testify v1.7.4
go.opentelemetry.io/collector v0.53.0
go.opentelemetry.io/collector/pdata v0.53.0
go.uber.org/multierr v1.8.0
Expand Down Expand Up @@ -449,7 +449,7 @@ require (
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.11.0 // indirect
github.com/stretchr/objx v0.3.0 // indirect
github.com/stretchr/objx v0.4.0 // indirect
github.com/subosito/gotenv v1.2.0 // indirect
github.com/syndtr/gocapability v0.0.0-20200815063812-42c35b437635 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
Expand Down 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
46 changes: 6 additions & 40 deletions cmd/configschema/go.sum

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

25 changes: 25 additions & 0 deletions exporter/prometheusexporter/collector.go
Expand Up @@ -215,11 +215,36 @@ func (c *collector) convertDoubleHistogram(metric pmetric.Metric, resourceAttrs
points[bucket] = cumCount
}

arrLen := ip.Exemplars().Len()
exemplars := make([]prometheus.Exemplar, arrLen)
for i := 0; i < arrLen; i++ {
e := ip.Exemplars().At(i)

labels := make(prometheus.Labels, e.FilteredAttributes().Len())
e.FilteredAttributes().Range(func(k string, v pcommon.Value) bool {
labels[k] = v.AsString()
return true
})

exemplars[i] = prometheus.Exemplar{
Value: e.DoubleVal(),
Labels: labels,
Timestamp: e.Timestamp().AsTime(),
}
}

m, err := prometheus.NewConstHistogram(desc, ip.Count(), ip.Sum(), points, attributes...)
if err != nil {
return nil, err
}

if arrLen > 0 {
m, err = prometheus.NewMetricWithExemplars(m, exemplars...)
if err != nil {
return nil, err
}
}

if c.sendTimestamps {
return prometheus.NewMetricWithTimestamp(ip.Timestamp().AsTime(), m), nil
}
Expand Down

0 comments on commit 8946486

Please sign in to comment.