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

Enable generation and comparison of public API snapshots #3081

Merged
merged 10 commits into from
May 11, 2021

Conversation

Aneurysm9
Copy link
Member

Description: This adds some Makefile targets that use the apidiff tool to generate and compare public API snapshots. These comparisons can be used to detect whether breaking changes have been introduced or when new public API surface is added.

Link to tracking Issue: #2545

Testing: A snapshot was created from the v0.25.0 release and compared against the current HEAD:

Click to expand!
Changes found in go.opentelemetry.io/collector/component:
Incompatible changes:
- ApplicationStartInfo: removed
- DefaultApplicationStartInfo: removed
- ExporterCreateParams.ApplicationStartInfo: removed
- ExtensionCreateParams.ApplicationStartInfo: removed
- ProcessorCreateParams.ApplicationStartInfo: removed
- ReceiverCreateParams.ApplicationStartInfo: removed
Compatible changes:
- BuildInfo: added
- DefaultBuildInfo: added
- ExporterCreateParams.BuildInfo: added
- ExtensionCreateParams.BuildInfo: added
- ProcessorCreateParams.BuildInfo: added
- ReceiverCreateParams.BuildInfo: added
Changes found in go.opentelemetry.io/collector/component/componenterror:
Incompatible changes:
- ErrAlreadyStarted: removed
- ErrAlreadyStopped: removed
Changes found in go.opentelemetry.io/collector/component/componenthelper:
Compatible changes:
- ShutdownFunc.Shutdown: added
- StartFunc.Start: added
Changes found in go.opentelemetry.io/collector/config:
! second, different message for obj type go.opentelemetry.io/collector/config.Receiver interface{go.opentelemetry.io/collector/config.NamedEntity; go.opentelemetry.io/collector/config.validatable}, part ""
  first:  no longer implements Extension
  second: no longer implements Exporter
! second, different message for obj type go.opentelemetry.io/collector/config.Receiver interface{go.opentelemetry.io/collector/config.NamedEntity; go.opentelemetry.io/collector/config.validatable}, part ""
  first:  no longer implements Exporter
  second: no longer implements Processor
! second, different message for obj type go.opentelemetry.io/collector/config.Receiver interface{go.opentelemetry.io/collector/config.NamedEntity; go.opentelemetry.io/collector/config.validatable}, part ""
  first:  no longer implements Processor
  second: no longer implements NamedEntity
Incompatible changes:
- (*Parser).Viper: removed
- (*ReceiverSettings).Name: removed
- (*ReceiverSettings).SetName: removed
- (*ReceiverSettings).Type: removed
- Exporter: no longer implements Receiver
- Extension: no longer implements Receiver
- NamedEntity.Name, method set of Receiver: removed
- NamedEntity.SetName, method set of Receiver: removed
- NamedEntity.Type, method set of Receiver: removed
- Pipeline.Receivers: changed from []string to []ComponentID
- Processor: no longer implements Receiver
- Receiver: no longer implements NamedEntity
- ReceiverSettings.NameVal: removed
- ReceiverSettings.TypeVal: removed
- Receivers: changed from map[string]Receiver to map[ComponentID]Receiver
- identifiable.ID: added
- identifiable.SetIDName: added
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
- NewID: added
- NewIDWithName: added
- NewReceiverSettings: added
Changes found in go.opentelemetry.io/collector/config/configauth:
Incompatible changes:
- (*Authentication).ToServerOptions: removed
- Authentication.Attribute: removed
- Authentication.OIDC: removed
- Authenticator.Authenticate: changed from func(context.Context, map[string][]string) (context.Context, error) to func(context.Context, map[string][]string) error
- Authenticator.GrpcStreamServerInterceptor: added
- Authenticator.GrpcUnaryServerInterceptor: added
- Authenticator.Start: changed from func(context.Context) error to func(context.Context, go.opentelemetry.io/collector/component.Host) error
- Authenticator.StreamInterceptor: removed
- Authenticator.UnaryInterceptor: removed
- Closer.Close, method set of Authenticator: removed
- Component.Shutdown: added
- GroupsFromContext: removed
- NewAuthenticator: removed
- OIDC: removed
- SubjectFromContext: removed
Compatible changes:
- AuthenticateFunc: added
- Authentication.AuthenticatorName: added
- DefaultGrpcStreamServerInterceptor: added
- DefaultGrpcUnaryServerInterceptor: added
- GetAuthenticator: added
- GrpcStreamInterceptorFunc: added
- GrpcUnaryInterceptorFunc: added
- MockAuthenticator: added
Changes found in go.opentelemetry.io/collector/config/configgrpc:
Incompatible changes:
- (*GRPCServerSettings).ToServerOption: changed from func() ([]google.golang.org/grpc.ServerOption, error) to func(map[go.opentelemetry.io/collector/config.NamedEntity]go.opentelemetry.io/collector/component.Extension) ([]google.golang.org/grpc.ServerOption, error)
Changes found in go.opentelemetry.io/collector/consumer/consumererror:
Compatible changes:
- Logs.Unwrap: added
- Metrics.Unwrap: added
- Traces.Unwrap: added
Changes found in go.opentelemetry.io/collector/consumer/pdata:
Compatible changes:
- AnyValueArray.AppendEmpty: added
- AnyValueArray.RemoveIf: added
- DoubleDataPointSlice.AppendEmpty: added
- DoubleDataPointSlice.RemoveIf: added
- ExemplarSlice.AppendEmpty: added
- ExemplarSlice.RemoveIf: added
- HistogramDataPointSlice.AppendEmpty: added
- HistogramDataPointSlice.RemoveIf: added
- InstrumentationLibraryLogsSlice.AppendEmpty: added
- InstrumentationLibraryLogsSlice.RemoveIf: added
- InstrumentationLibraryMetricsSlice.AppendEmpty: added
- InstrumentationLibraryMetricsSlice.RemoveIf: added
- InstrumentationLibrarySpansSlice.AppendEmpty: added
- InstrumentationLibrarySpansSlice.RemoveIf: added
- IntDataPointSlice.AppendEmpty: added
- IntDataPointSlice.RemoveIf: added
- IntExemplarSlice.AppendEmpty: added
- IntExemplarSlice.RemoveIf: added
- IntHistogramDataPointSlice.AppendEmpty: added
- IntHistogramDataPointSlice.RemoveIf: added
- LogSlice.AppendEmpty: added
- LogSlice.RemoveIf: added
- MetricSlice.AppendEmpty: added
- MetricSlice.RemoveIf: added
- ResourceLogsSlice.AppendEmpty: added
- ResourceLogsSlice.RemoveIf: added
- ResourceMetricsSlice.AppendEmpty: added
- ResourceMetricsSlice.RemoveIf: added
- ResourceSpansSlice.AppendEmpty: added
- ResourceSpansSlice.RemoveIf: added
- SpanEventSlice.AppendEmpty: added
- SpanEventSlice.RemoveIf: added
- SpanLinkSlice.AppendEmpty: added
- SpanLinkSlice.RemoveIf: added
- SpanSlice.AppendEmpty: added
- SpanSlice.RemoveIf: added
- SummaryDataPointSlice.AppendEmpty: added
- SummaryDataPointSlice.RemoveIf: added
- ValueAtQuantileSlice.AppendEmpty: added
- ValueAtQuantileSlice.RemoveIf: added
Changes found in go.opentelemetry.io/collector/consumer/simple:
Incompatible changes:
- Metrics.MetricFactoriesByName: changed from map[string]func() go.opentelemetry.io/collector/consumer/pdata.Metric to map[string]func(go.opentelemetry.io/collector/consumer/pdata.Metric)
- SafeMetrics.MetricFactoriesByName: changed from map[string]func() go.opentelemetry.io/collector/consumer/pdata.Metric to map[string]func(go.opentelemetry.io/collector/consumer/pdata.Metric)
Changes found in go.opentelemetry.io/collector/exporter/kafkaexporter:
Incompatible changes:
- MetricsMarshaller: removed
- TracesMarshaller: removed
- WithAddTracesMarshallers: removed
Compatible changes:
- LogsMarshaler: added
- MetricsMarshaler: added
- TracesMarshaler: added
- WithTracesMarshalers: added
Changes found in go.opentelemetry.io/collector/exporter/prometheusexporter:
Compatible changes:
- Config.Enabled: added
- Config.ResourceToTelemetrySettings: added
Changes found in go.opentelemetry.io/collector/exporter/prometheusremotewriteexporter:
Compatible changes:
- Config.ResourceToTelemetrySettings: added
Changes found in go.opentelemetry.io/collector/internal/testcomponents:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *ExampleReceiver: removed
- (*ReceiverSettings).SetName, method set of *ExampleReceiver: removed
- (*ReceiverSettings).Type, method set of *ExampleReceiver: removed
- ExampleReceiver.NameVal: removed
- ExampleReceiver.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/internal/version:
Incompatible changes:
- BuildType: removed
- GitHash: removed
- IsDevBuild: removed
- IsReleaseBuild: removed
Changes found in go.opentelemetry.io/collector/receiver/hostmetricsreceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/hostmetricsreceiver/internal/metadata:
Incompatible changes:
- (*metricStruct).FactoriesByName: changed from func() map[string]func() go.opentelemetry.io/collector/consumer/pdata.Metric to func() map[string]func(go.opentelemetry.io/collector/consumer/pdata.Metric)
Changes found in go.opentelemetry.io/collector/receiver/jaegerreceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/kafkareceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
- LogsUnmarshaller: removed
- TracesUnmarshaller: removed
- WithAddLogsUnmarshallers: removed
- WithAddTracesUnmarshallers: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
- LogsUnmarshaler: added
- TracesUnmarshaler: added
- WithLogsUnmarshalers: added
- WithTracesUnmarshalers: added
Changes found in go.opentelemetry.io/collector/receiver/opencensusreceiver:
Incompatible changes:
- (*GRPCServerSettings).ToServerOption: changed from func() ([]google.golang.org/grpc.ServerOption, error) to func(map[go.opentelemetry.io/collector/config.NamedEntity]go.opentelemetry.io/collector/component.Extension) ([]google.golang.org/grpc.ServerOption, error)
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/otlpreceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/prometheusreceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/scraperhelper:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *ScraperControllerSettings: removed
- (*ReceiverSettings).SetName, method set of *ScraperControllerSettings: removed
- (*ReceiverSettings).Type, method set of *ScraperControllerSettings: removed
- ScraperControllerSettings.NameVal: removed
- ScraperControllerSettings.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/receiver/zipkinreceiver:
Incompatible changes:
- (*ReceiverSettings).Name, method set of *Config: removed
- (*ReceiverSettings).SetName, method set of *Config: removed
- (*ReceiverSettings).Type, method set of *Config: removed
- Config.NameVal: removed
- Config.TypeVal: removed
Compatible changes:
- (*ReceiverSettings).ID: added
- (*ReceiverSettings).SetIDName: added
Changes found in go.opentelemetry.io/collector/service:
Incompatible changes:
- Parameters.ApplicationStartInfo: removed
Compatible changes:
- Parameters.BuildInfo: added
Changes found in go.opentelemetry.io/collector/service/internal/builder:
Incompatible changes:
- BuildExporters: changed from func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.ApplicationStartInfo, *go.opentelemetry.io/collector/config.Config, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ExporterFactory) (Exporters, error) to func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.BuildInfo, *go.opentelemetry.io/collector/config.Config, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ExporterFactory) (Exporters, error)
- BuildExtensions: changed from func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.ApplicationStartInfo, *go.opentelemetry.io/collector/config.Config, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ExtensionFactory) (Extensions, error) to func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.BuildInfo, *go.opentelemetry.io/collector/config.Config, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ExtensionFactory) (Extensions, error)
- BuildPipelines: changed from func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.ApplicationStartInfo, *go.opentelemetry.io/collector/config.Config, Exporters, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ProcessorFactory) (BuiltPipelines, error) to func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.BuildInfo, *go.opentelemetry.io/collector/config.Config, Exporters, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ProcessorFactory) (BuiltPipelines, error)
- BuildReceivers: changed from func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.ApplicationStartInfo, *go.opentelemetry.io/collector/config.Config, BuiltPipelines, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ReceiverFactory) (Receivers, error) to func(*go.uber.org/zap.Logger, go.opentelemetry.io/collector/component.BuildInfo, *go.opentelemetry.io/collector/config.Config, BuiltPipelines, map[go.opentelemetry.io/collector/config.Type]go.opentelemetry.io/collector/component.ReceiverFactory) (Receivers, error)
Changes found in go.opentelemetry.io/collector/translator/trace:
Incompatible changes:
- DetermineValueType: changed from func(string, bool) go.opentelemetry.io/collector/consumer/pdata.AttributeValueType to func(string) go.opentelemetry.io/collector/consumer/pdata.AttributeValueType
- UpsertStringToAttributeMap: removed

Documentation: No documentation is added other than usage output for the new internal scripts as this is intended to be used in CI or during the release process. The precise mechanisms and timing for creating and comparing public API snapshots need to be determined and appropriate maintainer-facing documentation can be created at that time, if appropriate.

Copy link
Member

@tigrannajaryan tigrannajaryan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @Aneurysm9
@bogdandrutu I think this will be very useful to prevent breaking changes once we GA.

Makefile Outdated Show resolved Hide resolved
@bogdandrutu
Copy link
Member

@Aneurysm9 friendly ping :)

@bogdandrutu bogdandrutu merged commit dea2f6e into open-telemetry:main May 11, 2021
dashpole pushed a commit to dashpole/opentelemetry-collector that referenced this pull request Jun 14, 2021
…try#3081)

* Add `apidiff` to internal/tools

* Add Makefile target for building apidiff snapshots

* Add Makefile target for comparing API snapshots

* Update apidiff comparison to only output when changes are detected

* Fix missing newline at end of Makefile

Signed-off-by: Anthony J Mirabella <[email protected]>

* Tidy mods in internal/tools

Signed-off-by: Anthony J Mirabella <[email protected]>
ankitnayan pushed a commit to SigNoz/opentelemetry-collector that referenced this pull request Jul 27, 2021
…try#3081)

* Add `apidiff` to internal/tools

* Add Makefile target for building apidiff snapshots

* Add Makefile target for comparing API snapshots

* Update apidiff comparison to only output when changes are detected

* Fix missing newline at end of Makefile

Signed-off-by: Anthony J Mirabella <[email protected]>

* Tidy mods in internal/tools

Signed-off-by: Anthony J Mirabella <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants