Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert all cumulative temporality to delta #30

Merged
merged 1 commit into from
Aug 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ go 1.20

require (
github.com/klauspost/compress v1.16.7
github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0
github.com/spf13/cobra v1.7.0
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.4
Expand All @@ -18,6 +19,7 @@ require (
go.opentelemetry.io/collector/consumer v0.83.0
go.opentelemetry.io/collector/exporter v0.83.0
go.opentelemetry.io/collector/pdata v1.0.0-rcv0014
go.opentelemetry.io/collector/processor v0.83.0
go.opentelemetry.io/collector/receiver v0.83.0
go.opentelemetry.io/collector/receiver/otlpreceiver v0.83.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.16.0
Expand Down Expand Up @@ -68,6 +70,8 @@ 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.2.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 // indirect
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
Expand Down Expand Up @@ -98,7 +102,6 @@ require (
go.opentelemetry.io/collector/extension v0.83.0 // indirect
go.opentelemetry.io/collector/extension/auth v0.83.0 // indirect
go.opentelemetry.io/collector/featuregate v1.0.0-rcv0014 // indirect
go.opentelemetry.io/collector/processor v0.83.0 // indirect
go.opentelemetry.io/collector/semconv v0.83.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.42.1-0.20230612162650-64be7e574a17 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.42.0 // indirect
Expand Down
8 changes: 7 additions & 1 deletion go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,12 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/npillmayer/nestext v0.1.3/go.mod h1:h2lrijH8jpicr25dFY+oAJLyzlya6jhnuG+zWp9L0Uk=
github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0 h1:s7sUZ3/LCX3Tr0C0FfTwE3X9GwTeTBskoMaLlqPv8Kw=
github.com/open-telemetry/opentelemetry-collector-contrib/internal/filter v0.83.0/go.mod h1:3bOPivfVZIaylsOk9yhWGNeobT0Pn25UZs4OnuC+azA=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0 h1:yEuD/gKHNVMwjT4mRZAeUVCe/VO2tqeb5+aFim5jQJs=
github.com/open-telemetry/opentelemetry-collector-contrib/pkg/pdatautil v0.83.0/go.mod h1:WoSzL9NAVwvEy1lMwM2utn68g0Khoxm591WliToPnDQ=
github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0 h1:cnmSn6LVIIkBRfaSuBQNNphLXonFr5qD0+bCHgvAFws=
github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor v0.83.0/go.mod h1:bHhc2kT0wki+U0boNf5E0bmDbPDaI6AyzdXh/zvtFrE=
github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc=
github.com/pelletier/go-toml v1.7.0/go.mod h1:vwGMzjaWMwyfHwgIBhI2YUM4fB6nL6lVAvS1LBMMhTE=
Expand Down Expand Up @@ -583,7 +589,7 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0
golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4=
golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM=
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea h1:vLCWI/yYrdEHyN2JzIzPO3aaQJHQdp89IZBA/+azVC4=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
Expand Down
15 changes: 13 additions & 2 deletions internal/otelcollector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,12 @@ import (
"fmt"
"time"

"github.com/open-telemetry/opentelemetry-collector-contrib/processor/cumulativetodeltaprocessor"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/configtelemetry"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/otelcol"
"go.opentelemetry.io/collector/processor"
"go.opentelemetry.io/collector/receiver"
otlpreceiver "go.opentelemetry.io/collector/receiver/otlpreceiver"
"go.opentelemetry.io/collector/service"
Expand Down Expand Up @@ -51,6 +53,11 @@ func New(cfg CollectorConfig, logger *zap.Logger) (*Collector, error) {
return nil, fmt.Errorf("failed to create collector: %w", err)
}

factories.Processors, err = processor.MakeFactoryMap(cumulativetodeltaprocessor.NewFactory())
if err != nil {
return nil, fmt.Errorf("failed to create collector: %w", err)
}

factories.Exporters, err = exporter.MakeFactoryMap(inmemexporter.NewFactory(store))
if err != nil {
return nil, fmt.Errorf("failed to create collector: %w", err)
Expand Down Expand Up @@ -137,14 +144,18 @@ func (p staticConfigProvider) Get(
Receivers: map[component.ID]component.Config{
component.NewID("otlp"): p.otlpReceiverConfig,
},
Processors: map[component.ID]component.Config{
component.NewID("cumulativetodelta"): &cumulativetodeltaprocessor.Config{},
},
Exporters: map[component.ID]component.Config{
component.NewID("inmem"): &inmemexporter.Config{},
},
Service: service.Config{
Pipelines: map[component.ID]*pipelines.PipelineConfig{
component.NewID("metrics"): &pipelines.PipelineConfig{
Receivers: []component.ID{component.NewID("otlp")},
Exporters: []component.ID{component.NewID("inmem")},
Receivers: []component.ID{component.NewID("otlp")},
Processors: []component.ID{component.NewID("cumulativetodelta")},
Exporters: []component.ID{component.NewID("inmem")},
},
component.NewID("traces"): &pipelines.PipelineConfig{
Receivers: []component.ID{component.NewID("otlp")},
Expand Down