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

Replace incorrect usage of term "receivers" to "integrations" #73

Merged
merged 8 commits into from
Apr 10, 2023

Conversation

yuri-tceretian
Copy link
Contributor

The term "receivers" is used in many places and is confused with integrations. This PR renames structs, functions and log\error messages to use the correct term for the context.
This PR renames:

  • struct GrafanaReceivers to GrafanaIntegrations
  • struct GrafanaReceiver to GrafanaIntegrationConfig
  • struct TestReceiverConfigResult to TestIntegrationConfigResult
  • struct ReceiverTimeoutError to IntegrationTimeoutError
  • struct ReceiverValidationError to IntegrationValidationError
  • function ProcessNotifierError to ProcessIntegrationError

Also, it removes struct InvalidReceiverError because it is not used anywhere and can be replaced by IntegrationValidationError in usages.

This PR is structured the way so it is simpler to review it by commit.

@yuri-tceretian yuri-tceretian added enhancement New feature or request kata:am_unify labels Mar 29, 2023
@yuri-tceretian yuri-tceretian self-assigned this Mar 29, 2023
Err: fmt.Errorf("failed to parse notifier %s (UID: %s): %w", receiver.Name, receiver.UID, err),
return GrafanaReceiverConfig{}, &IntegrationValidationError{
Integration: receiver,
Err: err,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

type GrafanaReceivers struct {
Receivers []*GrafanaReceiver `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
type GrafanaIntegrations struct {
Integrations []*GrafanaIntegrationConfig `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we have plans to migrate the Yaml/JSON? Seems like a pain doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we will migrate to the structure upstream Alertmanager offers (a dictionary of lists).

Copy link
Contributor

@grobinson-grafana grobinson-grafana left a comment

Choose a reason for hiding this comment

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

Looks OK, but a little confused about the renaming of the error.

func TestReceiverTimeoutError_Error(t *testing.T) {
e := ReceiverTimeoutError{
Receiver: &GrafanaReceiver{
e := IntegrationTimeoutError{
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't this be something like

Suggested change
e := IntegrationTimeoutError{
e := InvalidIntegrationError{

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No sure I understand. Do you suggest renaming ReceiverTimeoutError to InvalidIntegrationError?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure what happened there, when I commented GitHub showed something else.

@@ -68,19 +57,19 @@ func (e timeoutError) Timeout() bool {
}

func TestProcessNotifierError(t *testing.T) {
t.Run("assert ReceiverTimeoutError is returned for context deadline exceeded", func(t *testing.T) {
r := &GrafanaReceiver{
t.Run("assert IntegrationTimeoutError is returned for context deadline exceeded", func(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm a bit confused, is there some behavioural change here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure I understand what you mean. I do not see any changes in this test other than names

Copy link
Contributor

Choose a reason for hiding this comment

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

Again this now looks different from when I commented, GitHub being weird?

@grobinson-grafana
Copy link
Contributor

Approved Yuri, what are the next steps needed to finish this renaming in Grafana?

@yuri-tceretian
Copy link
Contributor Author

The next steps would be to update the module version in Grafana update usages and do renaming there if necessary.

@yuri-tceretian yuri-tceretian merged commit 4a7ecc2 into main Apr 10, 2023
@yuri-tceretian yuri-tceretian deleted the yuri-tceretian/fix-config-names branch April 10, 2023 15:16
yuri-tceretian added a commit to grafana/grafana that referenced this pull request Apr 14, 2023
yuri-tceretian added a commit to grafana/grafana that referenced this pull request Apr 18, 2023
yuri-tceretian added a commit to grafana/grafana that referenced this pull request Apr 25, 2023
…actoring (#66622)

* update to alerting 20230418161049-5f374e58cb32
* rename renamed structs in grafana/alerting#73
* update ValidateContactPoint to use BuildReceiverConfiguration
* update logger factory according to changes
* rewrite integration builder
Co-authored-by: Santiago <santiagohernandez.1997@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kata:am_unify
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants