Skip to content

Commit 0e568b2

Browse files
arun-shopifytanner-bruceahayworth
authored
otel col contrib v0.61.0 (#2521)
* probabilisticsampler: add filterspan config * added filter to spanmetrics processor (#6) * prometheusexporter: use attributevalue * misc: reduce dependabot noise Because of the weird^H^H^H^H^Hinteresting structure of the contrib repo, we have an overwhelming amount of dependabot noise for this. Especially since we're behind upstream. We could turn this off entirely, I suppose. Or - we can modify the Makefile and just make this noise monthly rather than weekly. This commit is the result of modifying the `Makefile` to do monthly updates instead of weekly, as well as the result of running `make gendependabot`. * Monitoring spanmetrics (#797) * wip cache metric from spanmetrics * testing * testing * WIP: collecting metrics * metric name updated * Update exporter/prometheusexporter/prometheus.go Co-authored-by: tanner-bruce <[email protected]> * Update processor/spanmetricsprocessor/processor.go Co-authored-by: tanner-bruce <[email protected]> * wip error metrics * span metrics monitoring : refactored internal metrics counters * span metrics monitoring : added metricKey error * Update processor/spanmetricsprocessor/processor.go Co-authored-by: tanner-bruce <[email protected]> * Update processor/spanmetricsprocessor/processor.go Co-authored-by: tanner-bruce <[email protected]> * moved metric one loop up * unique metrics count * removed actice timeseries counter * Update processor/spanmetricsprocessor/processor.go Co-authored-by: tanner-bruce <[email protected]> Co-authored-by: tanner-bruce <[email protected]> * fix some merging issues Co-authored-by: Tanner Bruce <[email protected]> Co-authored-by: Andrew Hayworth <[email protected]> Co-authored-by: tanner-bruce <[email protected]>
1 parent 672a51a commit 0e568b2

File tree

10 files changed

+299
-183
lines changed

10 files changed

+299
-183
lines changed

.github/dependabot.yml

+180-164
Large diffs are not rendered by default.

Makefile

+4-4
Original file line numberDiff line numberDiff line change
@@ -162,23 +162,23 @@ gendependabot:
162162
@echo " - package-ecosystem: \"github-actions\"" >> ${DEPENDABOT_PATH}
163163
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
164164
@echo " schedule:" >> ${DEPENDABOT_PATH}
165-
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
165+
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
166166
@echo "Add entry for \"/\" docker"
167167
@echo " - package-ecosystem: \"docker\"" >> ${DEPENDABOT_PATH}
168168
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
169169
@echo " schedule:" >> ${DEPENDABOT_PATH}
170-
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
170+
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
171171
@echo "Add entry for \"/\" gomod"
172172
@echo " - package-ecosystem: \"gomod\"" >> ${DEPENDABOT_PATH}
173173
@echo " directory: \"/\"" >> ${DEPENDABOT_PATH}
174174
@echo " schedule:" >> ${DEPENDABOT_PATH}
175-
@echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}
175+
@echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}
176176
@set -e; for dir in $(NONROOT_MODS); do \
177177
echo "Add entry for \"$${dir:1}\""; \
178178
echo " - package-ecosystem: \"gomod\"" >> ${DEPENDABOT_PATH}; \
179179
echo " directory: \"$${dir:1}\"" >> ${DEPENDABOT_PATH}; \
180180
echo " schedule:" >> ${DEPENDABOT_PATH}; \
181-
echo " interval: \"weekly\"" >> ${DEPENDABOT_PATH}; \
181+
echo " interval: \"monthly\"" >> ${DEPENDABOT_PATH}; \
182182
done
183183

184184
# Define a delegation target for each module

processor/probabilisticsamplerprocessor/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,16 @@ package probabilisticsamplerprocessor // import "github.com/open-telemetry/opent
1616

1717
import (
1818
"go.opentelemetry.io/collector/config"
19+
20+
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterconfig"
1921
)
2022

2123
// Config has the configuration guiding the trace sampler processor.
2224
type Config struct {
2325
config.ProcessorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
2426

27+
filterconfig.MatchConfig `mapstructure:",squash"`
28+
2529
// SamplingPercentage is the percentage rate at which traces are going to be sampled. Defaults to zero, i.e.: no sample.
2630
// Values greater or equal 100 are treated as "sample all traces".
2731
SamplingPercentage float32 `mapstructure:"sampling_percentage"`

processor/probabilisticsamplerprocessor/go.mod

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@ require (
1313
require (
1414
github.com/davecgh/go-spew v1.1.1 // indirect
1515
github.com/gogo/protobuf v1.3.2 // indirect
16+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
1617
github.com/golang/protobuf v1.5.2 // indirect
1718
github.com/json-iterator/go v1.1.12 // indirect
1819
github.com/knadh/koanf v1.4.3 // indirect
19-
github.com/kr/pretty v0.3.0 // indirect
2020
github.com/mitchellh/copystructure v1.2.0 // indirect
2121
github.com/mitchellh/mapstructure v1.5.0 // indirect
2222
github.com/mitchellh/reflectwalk v1.0.2 // indirect
2323
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
2424
github.com/modern-go/reflect2 v1.0.2 // indirect
2525
github.com/pmezard/go-difflib v1.0.0 // indirect
26+
github.com/spf13/cast v1.5.0 // indirect
2627
go.opencensus.io v0.23.0 // indirect
2728
go.opentelemetry.io/otel v1.10.0 // indirect
2829
go.opentelemetry.io/otel/metric v0.32.1 // indirect

processor/probabilisticsamplerprocessor/go.sum

+4-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

processor/probabilisticsamplerprocessor/probabilisticsampler.go

+20
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ import (
2323
"go.opentelemetry.io/collector/pdata/pcommon"
2424
"go.opentelemetry.io/collector/pdata/ptrace"
2525
"go.opentelemetry.io/collector/processor/processorhelper"
26+
27+
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterspan"
2628
)
2729

2830
// samplingPriority has the semantic result of parsing the "sampling.priority"
@@ -52,15 +54,30 @@ const (
5254
type tracesamplerprocessor struct {
5355
scaledSamplingRate uint32
5456
hashSeed uint32
57+
include filterspan.Matcher
58+
exclude filterspan.Matcher
5559
}
5660

5761
// newTracesProcessor returns a processor.TracesProcessor that will perform head sampling according to the given
5862
// configuration.
63+
5964
func newTracesProcessor(ctx context.Context, set component.ProcessorCreateSettings, cfg *Config, nextConsumer consumer.Traces) (component.TracesProcessor, error) {
65+
66+
include, err := filterspan.NewMatcher(cfg.Include)
67+
if err != nil {
68+
return nil, err
69+
}
70+
exclude, err := filterspan.NewMatcher(cfg.Exclude)
71+
if err != nil {
72+
return nil, err
73+
}
74+
6075
tsp := &tracesamplerprocessor{
6176
// Adjust sampling percentage on private so recalculations are avoided.
6277
scaledSamplingRate: uint32(cfg.SamplingPercentage * percentageScaleFactor),
6378
hashSeed: cfg.HashSeed,
79+
include: include,
80+
exclude: exclude,
6481
}
6582

6683
return processorhelper.NewTracesProcessor(
@@ -76,6 +93,9 @@ func (tsp *tracesamplerprocessor) processTraces(_ context.Context, td ptrace.Tra
7693
td.ResourceSpans().RemoveIf(func(rs ptrace.ResourceSpans) bool {
7794
rs.ScopeSpans().RemoveIf(func(ils ptrace.ScopeSpans) bool {
7895
ils.Spans().RemoveIf(func(s ptrace.Span) bool {
96+
if filterspan.SkipSpan(tsp.include, tsp.exclude, s, rs.Resource(), ils.Scope()) {
97+
return false
98+
}
7999
sp := parseSpanSamplingPriority(s)
80100
if sp == doNotSampleSpan {
81101
// The OpenTelemetry mentions this as a "hint" we take a stronger

processor/spanmetricsprocessor/config.go

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ import (
2020
"go.opentelemetry.io/collector/config"
2121
"go.opentelemetry.io/collector/featuregate"
2222
"go.opentelemetry.io/collector/pdata/pmetric"
23+
24+
"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterconfig"
2325
)
2426

2527
const (
@@ -37,6 +39,8 @@ type Dimension struct {
3739
type Config struct {
3840
config.ProcessorSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct
3941

42+
filterconfig.MatchConfig `mapstructure:",squash"`
43+
4044
// MetricsExporter is the name of the metrics exporter to use to ship metrics.
4145
MetricsExporter string `mapstructure:"metrics_exporter"`
4246

processor/spanmetricsprocessor/go.mod

+3-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ require (
66
github.com/hashicorp/golang-lru v0.5.4
77
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.61.0
88
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.61.0
9+
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.61.0
910
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.61.0
1011
github.com/stretchr/testify v1.8.0
12+
go.opencensus.io v0.23.0
1113
go.opentelemetry.io/collector v0.61.0
1214
go.opentelemetry.io/collector/pdata v0.61.0
1315
go.opentelemetry.io/collector/semconv v0.61.0
@@ -31,6 +33,7 @@ require (
3133
github.com/go-logr/stdr v1.2.2 // indirect
3234
github.com/gogo/googleapis v1.4.1 // indirect
3335
github.com/gogo/protobuf v1.3.2 // indirect
36+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3437
github.com/golang/protobuf v1.5.2 // indirect
3538
github.com/golang/snappy v0.0.4 // indirect
3639
github.com/gorilla/handlers v1.5.1 // indirect
@@ -50,7 +53,6 @@ require (
5053
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5154
github.com/modern-go/reflect2 v1.0.2 // indirect
5255
github.com/mostynb/go-grpc-compression v1.1.17 // indirect
53-
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.61.0 // indirect
5456
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.61.0 // indirect
5557
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.61.0 // indirect
5658
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.61.0 // indirect
@@ -73,7 +75,6 @@ require (
7375
github.com/subosito/gotenv v1.3.0 // indirect
7476
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
7577
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
76-
go.opencensus.io v0.23.0 // indirect
7778
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.0 // indirect
7879
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 // indirect
7980
go.opentelemetry.io/otel v1.10.0 // indirect

processor/spanmetricsprocessor/go.sum

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)