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

Alertmanager: Add Grafana's external URL #8498

Conversation

santihernandezc
Copy link
Contributor

@santihernandezc santihernandezc commented Jun 24, 2024

This PR adds the Grafana external URL to an Alertmanager at creation time. This URL is sent from Grafana and will be used when templating notifications.

Related PoC: #8376

@santihernandezc santihernandezc marked this pull request as ready for review June 24, 2024 14:10
@santihernandezc santihernandezc requested review from a team as code owners June 24, 2024 14:10
@santihernandezc santihernandezc changed the title (WIP) Add Grafana's external URL Alertmanager: Add Grafana's external URL Jun 24, 2024
@@ -290,6 +291,8 @@ func (am *MultitenantAlertmanager) GetUserGrafanaConfig(w http.ResponseWriter, r
Hash: cfg.Hash,
CreatedAt: cfg.CreatedAtTimestamp,
Default: cfg.Default,
Promoted: cfg.Promoted,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Quick fix, we forgot to add this field in the response to GET api/v1/grafana/config

Copy link
Contributor

@stevesg stevesg left a comment

Choose a reason for hiding this comment

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

I'm finding this a little confusing. I'm not too keen on:
a) passing this extra string around as a parameter on the end of all these functions
b) the fact we pass the Mimir ExternalURL in completely different way

I think a nicer approach would be:

  • computeConfig determines the ExternalURL based on what configuration is in use
    • If the Mimir configuration is in use, pass the ExternalURL configured on the command line
    • If the Grafana configuration is in use, pass the ExternalURL from the configuration
  • That is then to ApplyConfig, which uses it to create the template

I'd rather see it passed around in a struct of some type, perhaps bundling a alertspb.AlertConfigDesc and the ExternalURL string together.

@@ -99,6 +99,7 @@ type Config struct {
PersisterConfig PersisterConfig

GrafanaAlertmanagerCompatibility bool
GrafanaExternalURL string
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to store it - it will only get used in ApplyConfig.

@santihernandezc
Copy link
Contributor Author

Closing in favor of #8465

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.

2 participants