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

More cleanup #11

Merged
merged 2 commits into from
Jul 18, 2022
Merged

More cleanup #11

merged 2 commits into from
Jul 18, 2022

Conversation

gotjosh
Copy link
Collaborator

@gotjosh gotjosh commented Jul 15, 2022

After this set of changes, and some modifications to the go.mod the tests and code now compiles and runs. The things I've removed I don't believe are needed for this layer but feel free to comment on them.

My next step is to setup the CI so that even if failing the tests run properly and start a more aggressive refactor from there.

After this set of changes, and some modifications to the `go.mod` the tests and code now compiles and runs. The things I've removed I don't believe are needed for this layer but feel free to comment on them.

My next step is to setup the CI so that even if failing the tests run properly and start a more aggressive refactor from there.
@gotjosh
Copy link
Collaborator Author

gotjosh commented Jul 15, 2022

Please pay attention to the removals - I think they don't belong on this layer and will stay within Grafana, so it's important to stop and think, "does this make sense to live in Grafana?" with the code I've removed.

Copy link
Contributor

@alexweav alexweav left a comment

Choose a reason for hiding this comment

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

LGTM, my comments are all more of discussion starters. We'll settle on the right thing as time goes on.

@@ -0,0 +1 @@
package alerting
Copy link
Contributor

Choose a reason for hiding this comment

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

Having two grafana_alertmanager and mimir_alertmanager files in the shared utils feels strange to me, since both grafana and the extracted mimir AM will eventually depend on this package. Shouldn't any implementation specific code live in the implementation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No on this stage - the design proposed that we first unify without modification so that we can import from both Grafana and Mimir as soon as possible.

Trying to unify before importing seems like an unnecessary risk, given, that we can unify as much as we want of both structures while still depending on two separate structures.


return orgAM, nil
}

// NilPeer and NilChannel implements the Alertmanager clustering interface.
type NilPeer struct{}
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this type useful anymore? Does it make any sense to keep this in multiorg_alertmanager.go as the only object, should the file be renamed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This type is def useful on this layer - NilPeer represents a null object for the clustering interface of the Alertmanager. However, I think you're right that this might not be its home - I've made a note in #8

Comment on lines -17 to -22
type Crypto interface {
LoadSecureSettings(ctx context.Context, orgId int64, receivers []*definitions.PostableApiReceiver) error
Encrypt(ctx context.Context, payload []byte, opt secrets.EncryptionOptions) ([]byte, error)

getDecryptedSecret(r *definitions.PostableGrafanaReceiver, key string) (string, error)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Grafana and mimir are almost certainly going to have different crypto implementations.

But, perhaps it'd be nice to keep a simpler shared interface for crypto defined here? Each project could then have an adapter that links its own crypto implementation to this interface.

That way, we don't have to really work around crypto at this level. It's an external dependency that is used in several places. A shared representation of it would be useful.

(If we do keep such an interface, it'd need simpler/different methods. These method names are taken directly from Grafana)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Good idea, I've made a note in #8

@gotjosh gotjosh mentioned this pull request Jul 18, 2022
@gotjosh gotjosh merged commit 86dae4c into main Jul 18, 2022
@gotjosh gotjosh deleted the run-tests branch July 18, 2022 08:57
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.

None yet

2 participants