Skip to content

Investigate tools that check for API compatibility for go modules #2545

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

Closed
bogdandrutu opened this issue Feb 24, 2021 · 7 comments
Closed

Investigate tools that check for API compatibility for go modules #2545

bogdandrutu opened this issue Feb 24, 2021 · 7 comments
Assignees
Labels
release:required-for-ga Must be resolved before GA release

Comments

@bogdandrutu
Copy link
Member

Enable them for modules that we mark as stable.

@bogdandrutu bogdandrutu added this to the Phase1-GA-Roadmap milestone Feb 24, 2021
@seankhliao
Copy link
Contributor

As part of golang/go#26420 the Go team is experimenting with gorelease and the related apidiff

@Aneurysm9
Copy link
Member

We have a need for similar capability in the Go SDK, so I can take this on.

@Aneurysm9
Copy link
Member

I was able to use apidiff to generate an API snapshot from the v0.23.0 release and then compare against the current HEAD and it appears to correctly identify changes:

$ make apidiff-compare                                                     
Changes found in go.opentelemetry.io/collector/consumer/consumererror:
Incompatible changes:
- CombineErrors: removed
- PartialError: removed
- PartialLogsError: removed
- PartialMetricsError: removed
- PartialTracesError: removed
Compatible changes:
- AsLogs: added
- AsMetrics: added
- AsTraces: added
- Combine: added
- Logs: added
- Metrics: added
- NewLogs: added
- NewMetrics: added
- NewTraces: added
- Traces: added
Changes found in go.opentelemetry.io/collector/consumer/pdata:
Incompatible changes:
- DoubleSummary: removed
- DoubleSummaryDataPoint: removed
- DoubleSummaryDataPointSlice: removed
- Metric.DoubleSummary: removed
- MetricDataTypeDoubleSummary: removed
- NewDoubleSummary: removed
- NewDoubleSummaryDataPoint: removed
- NewDoubleSummaryDataPointSlice: removed
Compatible changes:
- Metric.Summary: added
- MetricDataTypeSummary: added
- NewSummary: added
- NewSummaryDataPoint: added
- NewSummaryDataPointSlice: added
- Summary: added
- SummaryDataPoint: added
- SummaryDataPointSlice: added
Changes found in go.opentelemetry.io/collector/exporter/exporterhelper:
Incompatible changes:
- CreateTraceExporter: removed
Compatible changes:
- CreateTracesExporter: added
Changes found in go.opentelemetry.io/collector/obsreport:
Incompatible changes:
- NewExporter: changed from func(go.opentelemetry.io/collector/config/configtelemetry.Level, string) *Exporter to func(ExporterSettings) *Exporter
Compatible changes:
- ExporterSettings: added

This is currently operating on all packages in the go.opentelemetry.io/collector module. apidiff appears to not allow specifying a package version at runtime and must be in the directory containing go.mod for the package's module when generating a snapshot of the package API in order to use the files on disk, so additional work will be required to support scanning multiple modules.

$ apidiff go.opentelemetry.io/collector/exporter/[email protected] go.opentelemetry.io/collector/exporter/exporterhelper
loading go.opentelemetry.io/collector/exporter/[email protected]: -: can only use path@version syntax with 'go get' and 'go install' in module-aware mode

@bogdandrutu do you want my to put up a PR with things as I have it now, or should I continue working on being able to operate on a per-module basis? Chances are I wouldn't be able to pick up that work again until next week.

@bogdandrutu
Copy link
Member Author

@Aneurysm9 how do you suggest to enforce this? I am confident that unless we run this every PR we will forget about it. Maybe a github action that fails if changes are added to the PR?

@alolita
Copy link
Member

alolita commented May 12, 2021

@Aneurysm9 can you create an issue for building a GitHub Action workflow to check when changes are added (its an API diff check in a GHA workflow)?

cc @mxiamxia

@bogdandrutu
Copy link
Member Author

Probably we should have a github action that compares the PR with head and adds a comment or fails if changes are identified

@alolita
Copy link
Member

alolita commented May 18, 2021

Closing this issue as discussed with @bogdandrutu

New issue is #3220

@alolita alolita closed this as completed May 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:required-for-ga Must be resolved before GA release
Projects
None yet
Development

No branches or pull requests

4 participants