Skip to content

Commit

Permalink
Merge branch 'main' into rmdepservice
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdandrutu authored Aug 17, 2022
2 parents 7039810 + 8e194e8 commit 32cffb1
Show file tree
Hide file tree
Showing 71 changed files with 2,818 additions and 840 deletions.
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,38 @@
- Remove `ConfigProviderSettings.MapProviders`
- Remove `ConfigProviderSettings.MapConverters`
- Remove `featuregate.Registry.MustAppy`
- Remove deprecated funcs from `pdata` module. (#5911)
- Remove `pmetric.MetricDataPointFlags.String()`
- Remove `pmetric.NumberDataPoint.FlagsStruct()`
- Remove `pmetric.HistogramDataPoint.FlagsStruct()`
- Remove `pmetric.ExponentialHistogramDataPoint.FlagsStruct()`
- Remove `pmetric.SummaryDataPoint.FlagsStruct()`
- Remove deprecated settings from `obsreport`, `ProcessorSettings.Level` and `ExporterSettings.Level` (#5918)
- Replace `processorhelper.New[Traces|Metrics|Logs]Exporter` with `processorhelper.New[Traces|Metrics|Logs]ProcessorWithCreateSettings` definition (#5915)
- Replace `exporterhelper.New[Traces|Metrics|Logs]Exporter` with `exporterhelper.New[Traces|Metrics|Logs]ExporterWithContext` definition (#5914)
- Replace ``component.NewExtensionFactory`` with `component.NewExtensionFactoryWithStabilityLevel` definition (#5917)

### 🚩 Deprecations 🚩

- Deprecate `processorhelper.New[Traces|Metrics|Logs]ProcessorWithCreateSettings` in favor of `processorhelper.New[Traces|Metrics|Logs]Exporter` (#5915)
- Deprecates `LogRecord.Flags()` and `LogRecord.SetFlags()` in favor of `LogRecord.FlagsStruct()`. (#5866)
- Deprecate `exporterhelper.New[Traces|Metrics|Logs]ExporterWithContext` in favor of `exporterhelper.New[Traces|Metrics|Logs]Exporter` (#5914)
- Deprecate `component.NewExtensionFactoryWithStabilityLevel` in favor of `component.NewExtensionFactory` (#5917)
- Deprecate `plog.SeverityNumber[UPPERCASE]` constants (#5927)

### 💡 Enhancements 💡

- Add support to unmarshalls bytes into pmetric.Metrics with `jsoniter` in jsonUnmarshaler(#5433)
- Add httpprovider to allow loading config files stored in HTTP (#5810)
- Added `service.telemetry.traces.propagators` configuration to set propagators for collector's internal spans. (#5572)

### 🧰 Bug fixes 🧰

- Fix bug in setting the correct collector state after a configuration change event. (#5830)
- Fix json trace unmarshalling for numbers (#5924):
- Accept both string and number for int32/uint32.
- Read uint64 numbers without converting from int64.

## v0.58.0 Beta

### 🛑 Breaking changes 🛑
Expand Down
3 changes: 2 additions & 1 deletion cmd/otelcorecol/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ go 1.18
require (
github.com/stretchr/testify v1.8.0
go.opentelemetry.io/collector v0.58.0
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664
)

require (
Expand Down Expand Up @@ -59,6 +59,7 @@ require (
go.opentelemetry.io/collector/semconv v0.56.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0 // indirect
go.opentelemetry.io/contrib/propagators/b3 v1.9.0 // indirect
go.opentelemetry.io/contrib/zpages v0.34.0 // indirect
go.opentelemetry.io/otel v1.9.0 // indirect
go.opentelemetry.io/otel/exporters/prometheus v0.31.0 // indirect
Expand Down
5 changes: 4 additions & 1 deletion cmd/otelcorecol/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,8 @@ go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.3
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.34.0/go.mod h1:fk1+icoN47ytLSgkoWHLJrtVTSQ+HgmkNgPTKrk/Nsc=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0 h1:9NkMW03wwEzPtP/KciZ4Ozu/Uz5ZA7kfqXJIObnrjGU=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.34.0/go.mod h1:548ZsYzmT4PL4zWKRd8q/N4z0Wxzn/ZxUE+lkEpwWQA=
go.opentelemetry.io/contrib/propagators/b3 v1.9.0 h1:Lzb9zU98jCE2kyfCjWfSSsiQoGtvBL+COxvUBf7FNhU=
go.opentelemetry.io/contrib/propagators/b3 v1.9.0/go.mod h1:fyx3gFXn+4w5uWTTiqaI8oBNBW/6w9Ow5zxXf7NGixU=
go.opentelemetry.io/contrib/zpages v0.34.0 h1:8ZXfrPkhegp/5GQYrO0pWMv2k3DQ7f+VBjaS6fMaBLM=
go.opentelemetry.io/contrib/zpages v0.34.0/go.mod h1:zuVCe4eoOREH+liRJLCtGITqL3NiUvkdr6U/4j9iQRg=
go.opentelemetry.io/otel v1.9.0 h1:8WZNQFIB2a71LnANS9JeyidJKKGOOremcUtb/OtHISw=
Expand Down Expand Up @@ -539,8 +541,9 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220114195835-da31bd327af9/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a h1:dGzPydgVsqGcTRVwiLJ1jVbufYwmzD3LfVPLKsKg+0k=
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664 h1:v1W7bwXHsnLLloWYTVEdvGvA7BHMeBYsPcF0GLDxIRs=
golang.org/x/sys v0.0.0-20220808155132-1c4a2a72c664/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand Down
17 changes: 1 addition & 16 deletions component/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,30 +164,15 @@ type Factory interface {
// Type gets the type of the component created by this factory.
Type() config.Type

// Deprecated: [v0.58.0] replaced by the more specific versions in each Factory type.
StabilityLevel(config.DataType) StabilityLevel

unexportedFactoryFunc()
}

type baseFactory struct {
cfgType config.Type
stability map[config.DataType]StabilityLevel
cfgType config.Type
}

func (baseFactory) unexportedFactoryFunc() {}

func (bf baseFactory) Type() config.Type {
return bf.cfgType
}

func (bf baseFactory) StabilityLevel(dt config.DataType) StabilityLevel {
return bf.getStabilityLevel(dt)
}

func (bf baseFactory) getStabilityLevel(dt config.DataType) StabilityLevel {
if val, ok := bf.stability[dt]; ok {
return val
}
return StabilityLevelUndefined
}
2 changes: 1 addition & 1 deletion component/componenttest/nop_extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ type nopExtensionConfig struct {

// NewNopExtensionFactory returns a component.ExtensionFactory that constructs nop extensions.
func NewNopExtensionFactory() component.ExtensionFactory {
return component.NewExtensionFactoryWithStabilityLevel(
return component.NewExtensionFactory(
"nop",
func() config.Extension {
return &nopExtensionConfig{
Expand Down
17 changes: 10 additions & 7 deletions component/exporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,50 +153,53 @@ type exporterFactory struct {
baseFactory
ExporterCreateDefaultConfigFunc
CreateTracesExporterFunc
tracesStabilityLevel StabilityLevel
CreateMetricsExporterFunc
metricsStabilityLevel StabilityLevel
CreateLogsExporterFunc
logsStabilityLevel StabilityLevel
}

func (e exporterFactory) TracesExporterStability() StabilityLevel {
return e.getStabilityLevel(config.TracesDataType)
return e.tracesStabilityLevel
}

func (e exporterFactory) MetricsExporterStability() StabilityLevel {
return e.getStabilityLevel(config.MetricsDataType)
return e.metricsStabilityLevel
}

func (e exporterFactory) LogsExporterStability() StabilityLevel {
return e.getStabilityLevel(config.LogsDataType)
return e.logsStabilityLevel
}

// WithTracesExporter overrides the default "error not supported" implementation for CreateTracesExporter and the default "undefined" stability level.
func WithTracesExporter(createTracesExporter CreateTracesExporterFunc, sl StabilityLevel) ExporterFactoryOption {
return exporterFactoryOptionFunc(func(o *exporterFactory) {
o.stability[config.TracesDataType] = sl
o.tracesStabilityLevel = sl
o.CreateTracesExporterFunc = createTracesExporter
})
}

// WithMetricsExporter overrides the default "error not supported" implementation for CreateMetricsExporter and the default "undefined" stability level.
func WithMetricsExporter(createMetricsExporter CreateMetricsExporterFunc, sl StabilityLevel) ExporterFactoryOption {
return exporterFactoryOptionFunc(func(o *exporterFactory) {
o.stability[config.MetricsDataType] = sl
o.metricsStabilityLevel = sl
o.CreateMetricsExporterFunc = createMetricsExporter
})
}

// WithLogsExporter overrides the default "error not supported" implementation for CreateLogsExporter and the default "undefined" stability level.
func WithLogsExporter(createLogsExporter CreateLogsExporterFunc, sl StabilityLevel) ExporterFactoryOption {
return exporterFactoryOptionFunc(func(o *exporterFactory) {
o.stability[config.LogsDataType] = sl
o.logsStabilityLevel = sl
o.CreateLogsExporterFunc = createLogsExporter
})
}

// NewExporterFactory returns a ExporterFactory.
func NewExporterFactory(cfgType config.Type, createDefaultConfig ExporterCreateDefaultConfigFunc, options ...ExporterFactoryOption) ExporterFactory {
f := &exporterFactory{
baseFactory: baseFactory{cfgType: cfgType, stability: make(map[config.DataType]StabilityLevel)},
baseFactory: baseFactory{cfgType: cfgType},
ExporterCreateDefaultConfigFunc: createDefaultConfig,
}
for _, opt := range options {
Expand Down
13 changes: 7 additions & 6 deletions component/extension.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,17 @@ func (ef *extensionFactory) ExtensionStability() StabilityLevel {
return ef.extensionStability
}

// Deprecated: [v0.58.0] use NewExtensionFactoryWithStabilityLevel.
func NewExtensionFactory(
// Deprecated: [v0.58.0] use NewExtensionFactory.
func NewExtensionFactoryWithStabilityLevel(
cfgType config.Type,
createDefaultConfig ExtensionCreateDefaultConfigFunc,
createServiceExtension CreateExtensionFunc) ExtensionFactory {
return NewExtensionFactoryWithStabilityLevel(cfgType, createDefaultConfig, createServiceExtension, StabilityLevelUndefined)
createServiceExtension CreateExtensionFunc,
sl StabilityLevel) ExtensionFactory {
return NewExtensionFactory(cfgType, createDefaultConfig, createServiceExtension, sl)
}

// NewExtensionFactoryWithStabilityLevel returns a new ExtensionFactory based on this configuration.
func NewExtensionFactoryWithStabilityLevel(
// NewExtensionFactory returns a new ExtensionFactory based on this configuration.
func NewExtensionFactory(
cfgType config.Type,
createDefaultConfig ExtensionCreateDefaultConfigFunc,
createServiceExtension CreateExtensionFunc,
Expand Down
2 changes: 1 addition & 1 deletion component/extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func TestNewExtensionFactory(t *testing.T) {
defaultCfg := config.NewExtensionSettings(config.NewComponentID(typeStr))
nopExtensionInstance := new(nopExtension)

factory := NewExtensionFactoryWithStabilityLevel(
factory := NewExtensionFactory(
typeStr,
func() config.Extension { return &defaultCfg },
func(ctx context.Context, settings ExtensionCreateSettings, extension config.Extension) (Extension, error) {
Expand Down
6 changes: 3 additions & 3 deletions component/factories_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ func TestMakeExtensionFactoryMap(t *testing.T) {
out map[config.Type]ExtensionFactory
}

p1 := NewExtensionFactoryWithStabilityLevel("p1", nil, nil, StabilityLevelAlpha)
p2 := NewExtensionFactoryWithStabilityLevel("p2", nil, nil, StabilityLevelAlpha)
p1 := NewExtensionFactory("p1", nil, nil, StabilityLevelAlpha)
p2 := NewExtensionFactory("p2", nil, nil, StabilityLevelAlpha)
testCases := []testCase{
{
name: "different names",
Expand All @@ -42,7 +42,7 @@ func TestMakeExtensionFactoryMap(t *testing.T) {
},
{
name: "same name",
in: []ExtensionFactory{p1, p2, NewExtensionFactoryWithStabilityLevel("p1", nil, nil, StabilityLevelAlpha)},
in: []ExtensionFactory{p1, p2, NewExtensionFactory("p1", nil, nil, StabilityLevelAlpha)},
},
}
for i := range testCases {
Expand Down
17 changes: 10 additions & 7 deletions component/processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,50 +168,53 @@ type processorFactory struct {
baseFactory
ProcessorCreateDefaultConfigFunc
CreateTracesProcessorFunc
tracesStabilityLevel StabilityLevel
CreateMetricsProcessorFunc
metricsStabilityLevel StabilityLevel
CreateLogsProcessorFunc
logsStabilityLevel StabilityLevel
}

func (p processorFactory) TracesProcessorStability() StabilityLevel {
return p.getStabilityLevel(config.TracesDataType)
return p.tracesStabilityLevel
}

func (p processorFactory) MetricsProcessorStability() StabilityLevel {
return p.getStabilityLevel(config.MetricsDataType)
return p.metricsStabilityLevel
}

func (p processorFactory) LogsProcessorStability() StabilityLevel {
return p.getStabilityLevel(config.LogsDataType)
return p.logsStabilityLevel
}

// WithTracesProcessor overrides the default "error not supported" implementation for CreateTracesProcessor and the default "undefined" stability level.
func WithTracesProcessor(createTracesProcessor CreateTracesProcessorFunc, sl StabilityLevel) ProcessorFactoryOption {
return processorFactoryOptionFunc(func(o *processorFactory) {
o.stability[config.TracesDataType] = sl
o.tracesStabilityLevel = sl
o.CreateTracesProcessorFunc = createTracesProcessor
})
}

// WithMetricsProcessor overrides the default "error not supported" implementation for CreateMetricsProcessor and the default "undefined" stability level.
func WithMetricsProcessor(createMetricsProcessor CreateMetricsProcessorFunc, sl StabilityLevel) ProcessorFactoryOption {
return processorFactoryOptionFunc(func(o *processorFactory) {
o.stability[config.MetricsDataType] = sl
o.metricsStabilityLevel = sl
o.CreateMetricsProcessorFunc = createMetricsProcessor
})
}

// WithLogsProcessor overrides the default "error not supported" implementation for CreateLogsProcessor and the default "undefined" stability level.
func WithLogsProcessor(createLogsProcessor CreateLogsProcessorFunc, sl StabilityLevel) ProcessorFactoryOption {
return processorFactoryOptionFunc(func(o *processorFactory) {
o.stability[config.LogsDataType] = sl
o.logsStabilityLevel = sl
o.CreateLogsProcessorFunc = createLogsProcessor
})
}

// NewProcessorFactory returns a ProcessorFactory.
func NewProcessorFactory(cfgType config.Type, createDefaultConfig ProcessorCreateDefaultConfigFunc, options ...ProcessorFactoryOption) ProcessorFactory {
f := &processorFactory{
baseFactory: baseFactory{cfgType: cfgType, stability: make(map[config.DataType]StabilityLevel)},
baseFactory: baseFactory{cfgType: cfgType},
ProcessorCreateDefaultConfigFunc: createDefaultConfig,
}
for _, opt := range options {
Expand Down
17 changes: 10 additions & 7 deletions component/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,50 +213,53 @@ type receiverFactory struct {
baseFactory
ReceiverCreateDefaultConfigFunc
CreateTracesReceiverFunc
tracesStabilityLevel StabilityLevel
CreateMetricsReceiverFunc
metricsStabilityLevel StabilityLevel
CreateLogsReceiverFunc
logsStabilityLevel StabilityLevel
}

func (r receiverFactory) TracesReceiverStability() StabilityLevel {
return r.getStabilityLevel(config.TracesDataType)
return r.tracesStabilityLevel
}

func (r receiverFactory) MetricsReceiverStability() StabilityLevel {
return r.getStabilityLevel(config.MetricsDataType)
return r.metricsStabilityLevel
}

func (r receiverFactory) LogsReceiverStability() StabilityLevel {
return r.getStabilityLevel(config.LogsDataType)
return r.logsStabilityLevel
}

// WithTracesReceiver overrides the default "error not supported" implementation for CreateTracesReceiver and the default "undefined" stability level.
func WithTracesReceiver(createTracesReceiver CreateTracesReceiverFunc, sl StabilityLevel) ReceiverFactoryOption {
return receiverFactoryOptionFunc(func(o *receiverFactory) {
o.stability[config.TracesDataType] = sl
o.tracesStabilityLevel = sl
o.CreateTracesReceiverFunc = createTracesReceiver
})
}

// WithMetricsReceiver overrides the default "error not supported" implementation for CreateMetricsReceiver and the default "undefined" stability level.
func WithMetricsReceiver(createMetricsReceiver CreateMetricsReceiverFunc, sl StabilityLevel) ReceiverFactoryOption {
return receiverFactoryOptionFunc(func(o *receiverFactory) {
o.stability[config.MetricsDataType] = sl
o.metricsStabilityLevel = sl
o.CreateMetricsReceiverFunc = createMetricsReceiver
})
}

// WithLogsReceiver overrides the default "error not supported" implementation for CreateLogsReceiver and the default "undefined" stability level.
func WithLogsReceiver(createLogsReceiver CreateLogsReceiverFunc, sl StabilityLevel) ReceiverFactoryOption {
return receiverFactoryOptionFunc(func(o *receiverFactory) {
o.stability[config.LogsDataType] = sl
o.logsStabilityLevel = sl
o.CreateLogsReceiverFunc = createLogsReceiver
})
}

// NewReceiverFactory returns a ReceiverFactory.
func NewReceiverFactory(cfgType config.Type, createDefaultConfig ReceiverCreateDefaultConfigFunc, options ...ReceiverFactoryOption) ReceiverFactory {
f := &receiverFactory{
baseFactory: baseFactory{cfgType: cfgType, stability: make(map[config.DataType]StabilityLevel)},
baseFactory: baseFactory{cfgType: cfgType},
ReceiverCreateDefaultConfigFunc: createDefaultConfig,
}
for _, opt := range options {
Expand Down
13 changes: 13 additions & 0 deletions confmap/provider/httpprovider/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
What is this new component httpprovider?
- An implementation of `confmap.Provider` for HTTP (httpprovider) allows OTEL Collector the ability to load configuration for itself by fetching and reading config files stored in HTTP servers.

How this new component httpprovider works?
- It will be called by `confmap.Resolver` to load configurations for OTEL Collector.
- By giving a config URI starting with prefix 'http://', this httpprovider will be used to download config files from given HTTP URIs, and then used the downloaded config files to deploy the OTEL Collector.
- In our code, we check the validity scheme and string pattern of HTTP URIs. And also check if there are any problems on config downloading and config deserialization.

Expected URI format:
- http://...

Prerequistes:
- Need to setup a HTTP server ahead, which returns with a config files according to the given URI
Loading

0 comments on commit 32cffb1

Please sign in to comment.