Skip to content

Commit

Permalink
otel col contrib v0.61.0 (#2521)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
4 people authored Sep 30, 2022
1 parent 672a51a commit 0e568b2
Show file tree
Hide file tree
Showing 10 changed files with 299 additions and 183 deletions.
344 changes: 180 additions & 164 deletions .github/dependabot.yml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,23 +162,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
4 changes: 4 additions & 0 deletions processor/probabilisticsamplerprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,16 @@ package probabilisticsamplerprocessor // import "github.com/open-telemetry/opent

import (
"go.opentelemetry.io/collector/config"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterconfig"
)

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

filterconfig.MatchConfig `mapstructure:",squash"`

// SamplingPercentage is the percentage rate at which traces are going to be sampled. Defaults to zero, i.e.: no sample.
// Values greater or equal 100 are treated as "sample all traces".
SamplingPercentage float32 `mapstructure:"sampling_percentage"`
Expand Down
3 changes: 2 additions & 1 deletion processor/probabilisticsamplerprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,17 @@ require (
require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/knadh/koanf v1.4.3 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/mitchellh/copystructure v1.2.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/reflectwalk v1.0.2 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/spf13/cast v1.5.0 // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/metric v0.32.1 // indirect
Expand Down
10 changes: 4 additions & 6 deletions processor/probabilisticsamplerprocessor/go.sum

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

20 changes: 20 additions & 0 deletions processor/probabilisticsamplerprocessor/probabilisticsampler.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
"go.opentelemetry.io/collector/processor/processorhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterspan"
)

// samplingPriority has the semantic result of parsing the "sampling.priority"
Expand Down Expand Up @@ -52,15 +54,30 @@ const (
type tracesamplerprocessor struct {
scaledSamplingRate uint32
hashSeed uint32
include filterspan.Matcher
exclude filterspan.Matcher
}

// newTracesProcessor returns a processor.TracesProcessor that will perform head sampling according to the given
// configuration.

func newTracesProcessor(ctx context.Context, set component.ProcessorCreateSettings, cfg *Config, nextConsumer consumer.Traces) (component.TracesProcessor, error) {

include, err := filterspan.NewMatcher(cfg.Include)
if err != nil {
return nil, err
}
exclude, err := filterspan.NewMatcher(cfg.Exclude)
if err != nil {
return nil, err
}

tsp := &tracesamplerprocessor{
// Adjust sampling percentage on private so recalculations are avoided.
scaledSamplingRate: uint32(cfg.SamplingPercentage * percentageScaleFactor),
hashSeed: cfg.HashSeed,
include: include,
exclude: exclude,
}

return processorhelper.NewTracesProcessor(
Expand All @@ -76,6 +93,9 @@ func (tsp *tracesamplerprocessor) processTraces(_ context.Context, td ptrace.Tra
td.ResourceSpans().RemoveIf(func(rs ptrace.ResourceSpans) bool {
rs.ScopeSpans().RemoveIf(func(ils ptrace.ScopeSpans) bool {
ils.Spans().RemoveIf(func(s ptrace.Span) bool {
if filterspan.SkipSpan(tsp.include, tsp.exclude, s, rs.Resource(), ils.Scope()) {
return false
}
sp := parseSpanSamplingPriority(s)
if sp == doNotSampleSpan {
// The OpenTelemetry mentions this as a "hint" we take a stronger
Expand Down
4 changes: 4 additions & 0 deletions processor/spanmetricsprocessor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import (
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/featuregate"
"go.opentelemetry.io/collector/pdata/pmetric"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal/processor/filterconfig"
)

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

filterconfig.MatchConfig `mapstructure:",squash"`

// MetricsExporter is the name of the metrics exporter to use to ship metrics.
MetricsExporter string `mapstructure:"metrics_exporter"`

Expand Down
5 changes: 3 additions & 2 deletions processor/spanmetricsprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ require (
github.com/hashicorp/golang-lru v0.5.4
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/jaegerexporter v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.61.0
github.com/open-telemetry/opentelemetry-collector-contrib/receiver/jaegerreceiver v0.61.0
github.com/stretchr/testify v1.8.0
go.opencensus.io v0.23.0
go.opentelemetry.io/collector v0.61.0
go.opentelemetry.io/collector/pdata v0.61.0
go.opentelemetry.io/collector/semconv v0.61.0
Expand All @@ -31,6 +33,7 @@ require (
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/googleapis v1.4.1 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/handlers v1.5.1 // indirect
Expand All @@ -50,7 +53,6 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/mostynb/go-grpc-compression v1.1.17 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/jaeger v0.61.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/translator/prometheus v0.61.0 // indirect
Expand All @@ -73,7 +75,6 @@ require (
github.com/subosito/gotenv v1.3.0 // indirect
github.com/uber/jaeger-client-go v2.30.0+incompatible // indirect
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
go.opencensus.io v0.23.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.36.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.1 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
Expand Down
1 change: 1 addition & 0 deletions processor/spanmetricsprocessor/go.sum

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

Loading

0 comments on commit 0e568b2

Please sign in to comment.