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

[exporter/otlp] split into its own module #6228

Closed

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Oct 3, 2022

Fixes #6195

@codeboten codeboten force-pushed the codeboten/otlp-exporter-mod branch 2 times, most recently from 4682b5a to 2431d25 Compare October 6, 2022 21:01
@codeboten codeboten marked this pull request as ready for review October 6, 2022 21:02
@codeboten codeboten requested review from a team and bogdandrutu October 6, 2022 21:02
@codecov
Copy link

codecov bot commented Oct 6, 2022

Codecov Report

Base: 92.04% // Head: 91.94% // Decreases project coverage by -0.09% ⚠️

Coverage data is based on head (585d5f6) compared to base (6313054).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6228      +/-   ##
==========================================
- Coverage   92.04%   91.94%   -0.10%     
==========================================
  Files         219      219              
  Lines       13245    13245              
==========================================
- Hits        12191    12178      -13     
- Misses        830      843      +13     
  Partials      224      224              
Impacted Files Coverage Δ
exporters/otlpgrpcexporter/config.go 0.00% <ø> (ø)
exporters/otlpgrpcexporter/factory.go 90.90% <ø> (ø)
exporters/otlpgrpcexporter/otlp.go 90.42% <ø> (ø)
cmd/otelcorecol/components.go 63.63% <100.00%> (ø)
config/configgrpc/configgrpc.go 87.98% <0.00%> (-4.81%) ⬇️
exporter/exporterhelper/traces.go 85.00% <0.00%> (-1.67%) ⬇️
exporter/exporterhelper/queued_retry.go 95.23% <0.00%> (-0.74%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

exporter/otlpexporter/go.mod Outdated Show resolved Hide resolved
@codeboten codeboten force-pushed the codeboten/otlp-exporter-mod branch 2 times, most recently from 0843748 to cd66232 Compare October 11, 2022 15:50
@bogdandrutu
Copy link
Member

I think we should send also a PR to remove https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/doc.go since it belongs (will) to a module without anything in that parent directory. Also think what we want to do with https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter#general-information since it feels strange that it belongs to a different module.

Maybe we create a module "exporter" with all the exporters?

@codeboten
Copy link
Contributor Author

I think we should send also a PR to remove https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/doc.go since it belongs (will) to a module without anything in that parent directory

I agree this makes sense once all the other exporters are split into their own modules.

Also think what we want to do with https://github.com/open-telemetry/opentelemetry-collector/tree/main/exporter#general-information since it feels strange that it belongs to a different module.

This could likely be moved under the docs directory in something called exporter.md? Maybe there should be a components directory under docs?

Maybe we create a module "exporter" with all the exporters?

What would the result of someone including that module be? All the exporters get pulled in? I wonder if it would be confusing for users as it may be unclear what exporters fall under that package.

@bogdandrutu
Copy link
Member

What would the result of someone including that module be? All the exporters get pulled in? I wonder if it would be confusing for users as it may be unclear what exporters fall under that package.

"All the exporters get pulled in" pulled in where? All the exporters are available in the module, if you talk about the builder you need 2 lines one for module and one for import.

@bogdandrutu
Copy link
Member

bogdandrutu commented Oct 11, 2022

last one about this "structure" part:
I saw somewhere in contrib that go mod complains if you have a module go.opentelemetry.io/collector/exporter (in case in the future we want to use that package and module for some shared code between exporters) and go.opentelemetry.io/collector/exporter/otlpexporter. Can you check that?

The error:

Running target 'tidy' in module 'internal/aws/xray' as part of group 'internal'
/Library/Developer/CommandLineTools/usr/bin/make -C internal/aws/xray tidy
rm -fr go.sum
go mod tidy -compat=1.18
main module (github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray) does not contain package github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray/testdata/sampleapp
main module (github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray) does not contain package github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray/testdata/sampleserver

Is this something that we want to support in the future? Where do we consider to put a package for "common" things between exporters? One of the thought I had was that component.Exporter and component.ExporterFactory can/may be moved there?

@bogdandrutu
Copy link
Member

It looks to be related to this issue golang/go#30590, found starting from the code :)) https://cs.opensource.google/go/go/+/master:src/cmd/go/testdata/script/mod_dot.txt;l=30;bpv=1;bpt=0

@codeboten codeboten force-pushed the codeboten/otlp-exporter-mod branch from ec4b0a4 to c0786d5 Compare October 17, 2022 19:53
@codeboten
Copy link
Contributor Author

Another update to this PR here:

Please take a look @open-telemetry/collector-approvers

@dmitryax
Copy link
Member

dmitryax commented Oct 17, 2022

Renaming modules/packages is a significant breaking change for the API consumers. I believe this should be done with aliasing first. We should keep the old one for now. And create new module only with the references to the old package (not otherwise to prevent circular deps)

@dmitryax
Copy link
Member

dmitryax commented Oct 17, 2022

Also I'm still not convinced that we have significant enough reasons to rename exporter to exporters. Even if I like the plural more, I think we should clearly provide the reasoning behind that in this PR or an issue. Probably better to hav e a separate PR for that. This one is just about otlp exporter. Looks like the errors that @bogdandrutu posted are not relevant anymore?

@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

package otlpexporter // import "go.opentelemetry.io/collector/exporter/otlpexporter"
package otlpgrpcexporter // import "go.opentelemetry.io/collector/exporters/otlpgrpcexporter"
Copy link
Member

@dmitryax dmitryax Oct 17, 2022

Choose a reason for hiding this comment

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

Do we rename the package only but keep otlp as the component name that used in configs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

otlp in the config applies to both grpc and http exporters, my opinion is that it's fine to separate config from package name, but i don't feel strongly about it. i can revert if that's preferable.

Copy link
Member

Choose a reason for hiding this comment

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

otlp in the config applies to both grpc and http exporters,

otlphttpexporter uses otlphttp https://github.com/open-telemetry/opentelemetry-collector/blob/main/exporter/otlphttpexporter/factory.go#L33

I think we should keep module names consistent with the collector component names. I would vote for keeping otlpexporter without renaming it. This seems like the most important one

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sorry i was thinking of the receiver 😅

Copy link
Member

Choose a reason for hiding this comment

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

I think we should keep it as otlpexporter. It would otherwise be the only exporter with a mismatch between the Go module name and the configuration identifier.

@codeboten
Copy link
Contributor Author

Also I'm still not convinced that we have significant enough reasons to rename exporter to exporters. Even if I like the plural more, I think we should clearly provide the reasoning behind that in this PR or an issue. Probably better to have a separate PR for that. This one is just about otlp exporter. Looks like the errors that @bogdandrutu posted are not relevant anymore?

Since this is the first time we'll publish these components as separate modules, it's the time to decide on what makes the most sense. The plural does make more sense if it's going to contain more than one exporter, and as i mentioned it does align with otel-go.

That being said, I agree that deprecating/breaking the import path for users shouldn't be done lightly.

@codeboten
Copy link
Contributor Author

@dmitryax I opened an issue to discuss moving components to the plural subdirectory: #6337

@bogdandrutu
Copy link
Member

Looks like the errors that @bogdandrutu posted are not relevant anymore?

@dmitryax the errors I mentioned will be removed if we rename the package since, "exporter" package will be free to use.

Also I'm still not convinced that we have significant enough reasons to rename exporter to exporters.

@dmitryax can you confirm that the errors I mentioned are ok long term?

@codeboten
Copy link
Contributor Author

Closing in favour of #6343

@codeboten codeboten closed this Oct 19, 2022
@codeboten codeboten deleted the codeboten/otlp-exporter-mod branch October 19, 2022 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Split otlpexporter on its own module
4 participants