Skip to content

Commit

Permalink
Rebase on v0.24.0 upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmalek committed May 13, 2021
1 parent b832289 commit 44bb259
Show file tree
Hide file tree
Showing 40 changed files with 851 additions and 1,375 deletions.
19 changes: 19 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,25 @@ commands:
keys:
- cimg-go-pkg-mod-{{ arch }}-{{ checksum "go.sum" }}-v4

install_fluentbit:
steps:
- run: |
sudo chmod 0777 -R /opt
- restore_cache: # restores saved cache if no changes are detected since last run
keys:
- "cimg-fluentbit-{{ arch }}-1.5.3"
- run: |
sudo ln -s /opt/td-agent-bit/bin/td-agent-bit /usr/local/bin/fluent-bit
if [[ -f /opt/td-agent-bit/bin/td-agent-bit ]]; then
exit 0
fi
wget https://packages.fluentbit.io/ubuntu/bionic/pool/main/t/td-agent-bit/td-agent-bit_1.5.3_amd64.deb
sudo dpkg -i ./td-agent-bit*.deb
- save_cache:
key: cimg-fluentbit-{{ arch }}-1.5.3
paths:
- /opt/td-agent-bit

publish_docker_images:
parameters:
repo:
Expand Down
3 changes: 2 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ require (
github.com/open-telemetry/opentelemetry-collector-contrib/extension/storage v0.24.0
github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbyattrsprocessor v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/processor/groupbytraceprocessor v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/processor/k8sprocessor v0.0.0-00010101000000-000000000000
github.com/open-telemetry/opentelemetry-collector-contrib/processor/metricstransformprocessor v0.0.0-00010101000000-000000000000
Expand Down Expand Up @@ -72,7 +73,7 @@ require (
golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57
)

replace go.opentelemetry.io/collector => github.com/SumoLogic/opentelemetry-collector v0.22.0-sumo
replace go.opentelemetry.io/collector => github.com/SumoLogic/opentelemetry-collector v0.24.0-sumo

replace github.com/influxdata/telegraf => github.com/sumologic/telegraf v1.17.3-sumo

Expand Down
188 changes: 140 additions & 48 deletions go.sum

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions processor/cascadingfilterprocessor/cascading_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,26 +21,26 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer/pdata"
"go.uber.org/zap"

tsconfig "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
cfconfig "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
"github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/sampling"
)

var testValue = 10 * time.Millisecond
var cfg = tsconfig.Config{
ProcessorSettings: configmodels.ProcessorSettings{},
var cfg = cfconfig.Config{
ProcessorSettings: &config.ProcessorSettings{},
DecisionWait: 2 * time.Second,
NumTraces: 100,
ExpectedNewTracesPerSec: 100,
SpansPerSecond: 1000,
PolicyCfgs: []tsconfig.PolicyCfg{
PolicyCfgs: []cfconfig.PolicyCfg{
{
Name: "duration",
SpansPerSecond: 10,
PropertiesCfg: tsconfig.PropertiesCfg{
PropertiesCfg: cfconfig.PropertiesCfg{
MinDuration: &testValue,
},
},
Expand All @@ -56,8 +56,8 @@ func fillSpan(span *pdata.Span, durationMicros int64) {
startTime := nowTs - durationMicros*1000

span.Attributes().InsertInt("foo", 55)
span.SetStartTime(pdata.Timestamp(startTime))
span.SetEndTime(pdata.Timestamp(nowTs))
span.SetStartTimestamp(pdata.Timestamp(startTime))
span.SetEndTimestamp(pdata.Timestamp(nowTs))
}

func createTrace(fsp *cascadingFilterSpanProcessor, numSpans int, durationMicros int64) *sampling.TraceData {
Expand Down
4 changes: 2 additions & 2 deletions processor/cascadingfilterprocessor/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package config
import (
"time"

"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config"
)

// PolicyCfg holds the common configuration to all policies.
Expand Down Expand Up @@ -68,7 +68,7 @@ type StringAttributeCfg struct {

// Config holds the configuration for cascading-filter-based sampling.
type Config struct {
configmodels.ProcessorSettings `mapstructure:",squash"`
*config.ProcessorSettings `mapstructure:"-"`
// DecisionWait is the desired wait time from the arrival of the first span of
// trace until the decision about sampling it or not is evaluated.
DecisionWait time.Duration `mapstructure:"decision_wait"`
Expand Down
22 changes: 11 additions & 11 deletions processor/cascadingfilterprocessor/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component/componenttest"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configtest"

"github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
cfconfig "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
)

func TestLoadConfig(t *testing.T) {
factories, err := componenttest.ExampleComponents()
factories, err := componenttest.NopFactories()
assert.NoError(t, err)

factory := NewFactory()
Expand All @@ -45,8 +45,8 @@ func TestLoadConfig(t *testing.T) {
namePatternValue := "foo.*"

assert.Equal(t, cfg.Processors["cascading_filter"],
&config.Config{
ProcessorSettings: configmodels.ProcessorSettings{
&cfconfig.Config{
ProcessorSettings: &config.ProcessorSettings{
TypeVal: "cascading_filter",
NameVal: "cascading_filter",
},
Expand All @@ -55,17 +55,17 @@ func TestLoadConfig(t *testing.T) {
ExpectedNewTracesPerSec: 10,
SpansPerSecond: 1000,
ProbabilisticFilteringRatio: &probFilteringRatio,
PolicyCfgs: []config.PolicyCfg{
PolicyCfgs: []cfconfig.PolicyCfg{
{
Name: "test-policy-1",
},
{
Name: "test-policy-2",
NumericAttributeCfg: &config.NumericAttributeCfg{Key: "key1", MinValue: 50, MaxValue: 100},
NumericAttributeCfg: &cfconfig.NumericAttributeCfg{Key: "key1", MinValue: 50, MaxValue: 100},
},
{
Name: "test-policy-3",
StringAttributeCfg: &config.StringAttributeCfg{Key: "key2", Values: []string{"value1", "value2"}},
StringAttributeCfg: &cfconfig.StringAttributeCfg{Key: "key2", Values: []string{"value1", "value2"}},
},
{
Name: "test-policy-4",
Expand All @@ -74,19 +74,19 @@ func TestLoadConfig(t *testing.T) {
{
Name: "test-policy-5",
SpansPerSecond: 123,
NumericAttributeCfg: &config.NumericAttributeCfg{
NumericAttributeCfg: &cfconfig.NumericAttributeCfg{
Key: "key1", MinValue: 50, MaxValue: 100},
InvertMatch: true,
},
{
Name: "test-policy-6",
SpansPerSecond: 50,

PropertiesCfg: config.PropertiesCfg{MinDuration: &minDurationValue},
PropertiesCfg: cfconfig.PropertiesCfg{MinDuration: &minDurationValue},
},
{
Name: "test-policy-7",
PropertiesCfg: config.PropertiesCfg{
PropertiesCfg: cfconfig.PropertiesCfg{
NamePattern: &namePatternValue,
MinDuration: &minDurationValue,
MinNumberOfSpans: &minSpansValue,
Expand Down
16 changes: 8 additions & 8 deletions processor/cascadingfilterprocessor/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ import (

"go.opencensus.io/stats/view"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configmodels"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/consumer"
"go.opentelemetry.io/collector/processor/processorhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
cfconfig "github.com/open-telemetry/opentelemetry-collector-contrib/processor/cascadingfilterprocessor/config"
)

const (
Expand All @@ -48,9 +48,9 @@ func NewFactory() component.ProcessorFactory {
processorhelper.WithTraces(createTraceProcessor))
}

func createDefaultConfig() configmodels.Processor {
return &config.Config{
ProcessorSettings: configmodels.ProcessorSettings{
func createDefaultConfig() config.Processor {
return &cfconfig.Config{
ProcessorSettings: &config.ProcessorSettings{
TypeVal: typeStr,
NameVal: typeStr,
},
Expand All @@ -64,9 +64,9 @@ func createDefaultConfig() configmodels.Processor {
func createTraceProcessor(
_ context.Context,
params component.ProcessorCreateParams,
cfg configmodels.Processor,
nextConsumer consumer.TracesConsumer,
cfg config.Processor,
nextConsumer consumer.Traces,
) (component.TracesProcessor, error) {
tCfg := cfg.(*config.Config)
tCfg := cfg.(*cfconfig.Config)
return newTraceProcessor(params.Logger, nextConsumer, *tCfg)
}
2 changes: 1 addition & 1 deletion processor/cascadingfilterprocessor/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ require (
go.uber.org/zap v1.16.0
)

replace go.opentelemetry.io/collector => github.com/SumoLogic/opentelemetry-collector v0.22.0-sumo
replace go.opentelemetry.io/collector => github.com/SumoLogic/opentelemetry-collector v0.24.0-sumo
Loading

0 comments on commit 44bb259

Please sign in to comment.