Skip to content

Commit

Permalink
Remove the WithSpanLimits option
Browse files Browse the repository at this point in the history
  • Loading branch information
MrAlias committed Mar 30, 2022
1 parent c37e6f6 commit fbc3da0
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 63 deletions.
7 changes: 4 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
- Add the `WithLogger` option to `github.com/signalfx/splunk-otel-go/distro`
along with parsing of the `OTEL_LOG_LEVEL` environment variable to set the
logging level of the default logger used. (#336)
- Add the `WithSpanLimits` option to
`github.com/signalfx/splunk-otel-go/distro` to set the span limits used.
(#723)

### Changed

Expand All @@ -40,6 +37,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
(#720)
- The `OTEL_TRACES_SAMPLER` environment variable is now honored instead of only
defaulting to an always-on sampler. (#724)
- Set span limits to the Splunk defaults (the link count is limited to 1000,
the attribute value length is limited to 12000, and all other limts are set
to be unlimited) if they are not set by the user with environment variables.
(#723)

### Fixed

Expand Down
17 changes: 0 additions & 17 deletions distro/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,20 +297,3 @@ func WithLogger(l logr.Logger) Option {
c.Logger = l
})
}

// WithSpanLimits configures the span limits used by the distro.
//
// The OpenTelemetry environment limit variables
// (OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_ATTRIBUTE_COUNT_LIMIT,
// OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT,
// OTEL_SPAN_EVENT_COUNT_LIMIT, OTEL_SPAN_LINK_COUNT_LIMIT,
// OTEL_EVENT_ATTRIBUTE_COUNT_LIMIT, OTEL_LINK_ATTRIBUTE_COUNT_LIMIT) are used
// if this option is not provided.
//
// By default, the link count is limited to 1000, the attribute value length
// is limited to 12000, and all other limts are set to be unlimited.
func WithSpanLimits(limits trace.SpanLimits) Option {
return optionFunc(func(c *config) {
c.SpanLimits = &limits
})
}
43 changes: 0 additions & 43 deletions distro/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"go.opentelemetry.io/contrib/propagators/jaeger"
"go.opentelemetry.io/contrib/propagators/ot"
"go.opentelemetry.io/otel/propagation"
"go.opentelemetry.io/otel/sdk/trace"
)

type KeyValue struct {
Expand Down Expand Up @@ -119,48 +118,6 @@ var ConfigurationTests = []*ConfigFieldTest{
},
},
},
{
Name: "WithSpanLimits",
ValueFunc: func(c *config) interface{} {
return c.SpanLimits
},
DefaultValue: &trace.SpanLimits{
AttributeValueLengthLimit: 12000,
AttributeCountLimit: -1,
EventCountLimit: -1,
LinkCountLimit: 1000,
AttributePerEventCountLimit: -1,
AttributePerLinkCountLimit: -1,
},
EnvironmentTests: []KeyValue{
{Key: attributeValueLengthKey, Value: "10"},
{Key: spanAttributeValueLengthKey, Value: "10"},
{Key: attributeCountKey, Value: "10"},
{Key: spanAttributeCountKey, Value: "10"},
{Key: spanEventCountKey, Value: "10"},
{Key: spanEventAttributeCountKey, Value: "10"},
{Key: spanLinkCountKey, Value: "10"},
{Key: spanLinkAttributeCountKey, Value: "10"},
},
OptionTests: []OptionTest{
{
Name: "valid override",
Options: []Option{
WithSpanLimits(trace.SpanLimits{
AttributeValueLengthLimit: 100,
AttributeCountLimit: 100,
EventCountLimit: 100,
LinkCountLimit: 100,
AttributePerEventCountLimit: 100,
AttributePerLinkCountLimit: 100,
}),
},
AssertionFunc: func(t *testing.T, c *config) {
assert.Equal(t, expectedSL(100, 100, 100, 100, 100, 100), c.SpanLimits)
},
},
},
},
}

func newTestConfig(t *testing.T, opts ...Option) *config {
Expand Down

0 comments on commit fbc3da0

Please sign in to comment.