-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[chore] move dockerstats receiver's objects to package internal/docker/receiver #33038
[chore] move dockerstats receiver's objects to package internal/docker/receiver #33038
Conversation
5989d24
to
332b579
Compare
bump @andrzej-stencel |
53c647e
to
95e6c9a
Compare
I tried to investigate the failing checks, same thing happens here: https://github.com/open-telemetry/opentelemetry-collector-contrib/actions/runs/9086234384/job/24971438739?pr=33059 |
95e6c9a
to
17eb6a0
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The scope of changes is far too high to be done within one PR.
I would suggest split the PR into at least two:
- Updated internal package with shared functionality
- Removing duplicated functionality
While I partially agree, I'd like to make it clear whether this is the way it should be done, as purely transform |
I'm not sure if I understand correctly what @MovieStoreGuy is proposing. Is it to first duplicate the code from Docker Stats receiver into a common package (that would not be used anywhere?) and then separately remove the duplicated code from Docker Stats receiver, starting to use the common package? If my understanding is correct, I'm not sure if this would make review easier for me. But if that would make reviewing easier for @MovieStoreGuy then it's probably the way to go. |
pinging @MovieStoreGuy, could you clarify here? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks OK, it definitely is a big change and is breaking so it's not super ideal, though I'm happy to move it along in the interest of getting things done
I also don't think you can be marking things like this as [chore] since it has actual code changes and even user facing changes to the output of the metrics.
@@ -3946,7 +3946,7 @@ func (mb *MetricsBuilder) EmitForResource(rmo ...ResourceMetricsOption) { | |||
rm := pmetric.NewResourceMetrics() | |||
rm.SetSchemaUrl(conventions.SchemaURL) | |||
ils := rm.ScopeMetrics().AppendEmpty() | |||
ils.Scope().SetName("otelcol/dockerstatsreceiver") | |||
ils.Scope().SetName("otelcol/docker/receiver") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is technically a breaking change, and should be at least mentioned in the changelog.
@@ -35,24 +37,24 @@ type resultV2 struct { | |||
err error | |||
} | |||
|
|||
type metricsReceiver struct { | |||
config *Config | |||
type MetricsReceiver struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unsure how I feel about making all of these types and methods public. Is there an alternative to this?
For example, I can create the OTLP exporter with fairly minimal exposure to the public API.
t, err := otlphttpexporter.NewFactory().CreateTracesExporter(
ctx,
exporter.CreateSettings{
ID: component.NewID(component.MustNewType("mock_app_otlp_exporter")),
TelemetrySettings: componenttest.NewNopTelemetrySettings(),
BuildInfo: component.NewDefaultBuildInfo(),
},
&otlphttpexporter.Config{
ClientConfig: clientCfg,
Encoding: otlphttpexporter.EncodingProto,
},
)
Is there a way we could arrange this in a more effective way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I got an impression that this was necessary, but maybe this autoresolved at some point. Nevertheless, the PR is probably going to be split into smaller ones, so I will keep in mind your suggestion.
The process is slow because the amount of change is significantly high. If this was broken up in smaller PRs and incrementally moving packages and functionality then I could get behind it but as it stands this is ~11,000 additions.
It needs to be smaller and not a big bang, I don't mind how it is done but there needs to be more of a plan and reassurance that what is currently given. My suggestion was to move the required code into a shared package so we can at least reduce the change set and effectively review what is happening, then once that is merged the new package can be adopt and old code and functionality can be removed. In short, make the PRs smaller and easier to review and I'll be happy to review and approve as appropriate. |
There aren't many ways to break it into smaller chunks I can think of. One main problem is that there are many functions that use code generated by
Where maybe (second and third) or (third and fourth) can be merged into one. |
@aboguszewski-sumo I have a question about the overall approach taken with the new docker events/logs gathering. Why is the focus on moving docker stats receiver before creating the actual events receiver? I would've thought you create the |
@jamesmoessis This was something agreed quite early on: #31597 (comment)
I believe this was asked on SIG meeting on March 6th, again Andrzej might elaborate. From my perspective, it could be a pain to try to merge the receivers later on, as they could already have some differences in code structure. And again, we would be copying a lot of code, so there would be the same problem as in this PR. I already have a PoC of the events receiver so it is only a matter of adapting it to the final receiver that will be used. |
Fair enough, I am just exploring possibilities for making it easier for you to get the new features you want faster. |
I am closing this PR as it's going to be superseded by other ones. |
Description: Functions and structs that could be reused have been moved to a separate package in order to be able to deprecate this receiver.
For reasons and arguments to do so, please see #32023 (comment)
Does it need a changelog entry? IMO not, it's not a change in the collector's config/api.
cc @andrzej-stencel
Link to tracking Issue: #31597
Testing: old tests, moved
Documentation: old documentation, moved or regenerated