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

Refactor prometheusreceiver config to avoid some custom unmarshal work #29901

Merged
merged 1 commit into from Jan 17, 2024

Conversation

bogdandrutu
Copy link
Member

@bogdandrutu bogdandrutu commented Dec 15, 2023

This is NOT a user config breaking change.

This PR improves the usability of our public APIs removing unnecessary placeholders public members. For API developers they only need to interact with the new wrapper types and don't worry about placeholders.

Also this PR simplifies the unmarshalling logic allowing to add more fields more confidently.

Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

If this is a breaking change it needs significantly more description of its purpose and effect. What are we trying to do here? Why is it necessary and advisable? What impact does it have on users (both end users and developers of components that interact with this component)? There's no description on this PR nor is there an issue detailing what needs to change and why.

@dashpole
Copy link
Contributor

It is an API breaking change because it changes a public type. It isn't a breaking change for users.

@bogdandrutu
Copy link
Member Author

@Aneurysm9 tried to clarify what happens. It is a clear improvement in my opinion since we remove the hacky placeholders.

Copy link
Member

@Aneurysm9 Aneurysm9 left a comment

Choose a reason for hiding this comment

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

Still reviewing this but I'm on-call today and Monday and unlikely to be able to finish a review before Tuesday.

receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
@Aneurysm9
Copy link
Member

It is an API breaking change because it changes a public type. It isn't a breaking change for users.

API users are still users. Has this been communicated to @open-telemetry/operator-ta-maintainers? I know they're at least one group that is going to have an interest in this.

@bogdandrutu
Copy link
Member Author

API users are still users.

As per my understanding in the changelog we use api and user to differentiate between API users and end-user configuration/behavior breaking changes. If you disagree with these usages of the 2 words we can change that.

Has this been communicated to @open-telemetry/operator-ta-maintainers? I know they're at least one group that is going to have an interest in this.

I don't see a need to do that, since https://github.com/search?q=repo%3Aopen-telemetry%2Fopentelemetry-operator%20prometheusreceiver&type=code doesn't show any usage of the public API.

@bogdandrutu
Copy link
Member Author

@Aneurysm9 friendly ping

@bogdandrutu
Copy link
Member Author

@Aneurysm9 friendly ping

1 similar comment
@bogdandrutu
Copy link
Member Author

@Aneurysm9 friendly ping

@bogdandrutu bogdandrutu force-pushed the refactorprom branch 2 times, most recently from 5e618ff to 8d77098 Compare January 10, 2024 17:32
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

Apart from the failing unit tests due to the change in logic in one validation, this looks good.

Out of curiosity: are you doing this change so that you can build a more specialized Prometheus receiver? If so, this might benefit the Pure Storage receivers as well (cc @chrroberts-pure , @dgoscn)

receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
receiver/prometheusreceiver/factory.go Show resolved Hide resolved
@bogdandrutu bogdandrutu force-pushed the refactorprom branch 3 times, most recently from 4aaf902 to 0e0b4b2 Compare January 11, 2024 18:11
@bogdandrutu
Copy link
Member Author

Out of curiosity: are you doing this change so that you can build a more specialized Prometheus receiver? If so, this might benefit the Pure Storage receivers as well (cc @chrroberts-pure , @dgoscn)

For the moment focus on cleaning how we do unmarshal/validation and understand patterns.

Copy link
Contributor

@aknuds1 aknuds1 left a comment

Choose a reason for hiding this comment

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

LGTM - left some nits.

receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
return nil
}
// We need custom unmarshaling because prometheus "config" subkey defines its own
// YAML unmarshaling routines so we need to do it explicitly.
cfgMap["url"] = "http://placeholder" // we have to set it as else the marshal will fail
Copy link
Contributor

Choose a reason for hiding this comment

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

[Nit]

Suggested change
cfgMap["url"] = "http://placeholder" // we have to set it as else the marshal will fail
cfgMap["url"] = "http://placeholder" // we have to set it as else marshalling will fail

Copy link
Member Author

Choose a reason for hiding this comment

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

Done.

Copy link
Member Author

Choose a reason for hiding this comment

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

I am not a native english speaker, so I will not fight with the linter:

Error: prometheusreceiver/config.go:148:68: `marshalling` is a misspelling of `marshaling` (misspell)
	cfgMap["url"] = "http://placeholder" // we have to set it as else marshalling will fail

receiver/prometheusreceiver/config.go Outdated Show resolved Hide resolved
Copy link
Member

@jpkrohling jpkrohling left a comment

Choose a reason for hiding this comment

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

LGTM

@Aneurysm9 Aneurysm9 dismissed their stale review January 12, 2024 18:33

I still do not believe that there has been adequate explanation of the purpose or value of these changes or whether they are self-contained or the beginning of a stepwise refactoring to an unstated desired end state. That said, it is not my desire to be an impediment if the maintainers believe that this change must be made.

@bogdandrutu bogdandrutu force-pushed the refactorprom branch 2 times, most recently from 0e458de to ac09ec1 Compare January 13, 2024 01:08
@alolita
Copy link
Member

alolita commented Jan 13, 2024

Points noted @Aneurysm9 Thanks!

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
@jpkrohling
Copy link
Member

After careful consideration, I am proceeding to merge this PR in my capacity as a @open-telemetry/collector-contrib-maintainer. I would like to outline the reasons for this decision:

  • The modifications presented in this PR, particularly in relation to the config placeholder, represent an improvement to our code base.
  • The approach taken in this refactoring adheres to best practices, notably in maintaining the integrity of existing tests. Adjustments have been made solely for the incorporation of new types. This gives me a high level of confidence that the changes are unlikely to introduce new bugs, and may help in identifying any previously untested scenarios.
  • Although the motivations and subsequent steps for this change were not entirely clear, the nature of the change is such that I would have endorsed it if it were proposed for a component under my code ownership. It is important to maintain consistent standards across our contributors, particularly when they are not strangers to the project/SIG. In this case, the author has met the same level of quality and commitment we expect from all contributors.

@jpkrohling jpkrohling merged commit c10a264 into open-telemetry:main Jan 17, 2024
87 checks passed
@github-actions github-actions bot added this to the next release milestone Jan 17, 2024
@bogdandrutu bogdandrutu deleted the refactorprom branch January 17, 2024 17:18
cparkins pushed a commit to AmadeusITGroup/opentelemetry-collector-contrib that referenced this pull request Feb 1, 2024
open-telemetry#29901)

This is **NOT** a user config breaking change.

This PR improves the usability of our public APIs removing unnecessary
placeholders public members. For API developers they only need to
interact with the new wrapper types and don't worry about placeholders.

Also this PR simplifies the unmarshalling logic allowing to add more
fields more confidently.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
anthoai97 pushed a commit to anthoai97/opentelemetry-collector-contrib that referenced this pull request Feb 12, 2024
open-telemetry#29901)

This is **NOT** a user config breaking change.

This PR improves the usability of our public APIs removing unnecessary
placeholders public members. For API developers they only need to
interact with the new wrapper types and don't worry about placeholders.

Also this PR simplifies the unmarshalling logic allowing to add more
fields more confidently.

Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
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.

None yet

7 participants