Skip to content

Comments

Move and integrate Receiver configuration#484

Open
yuri-tceretian wants to merge 9 commits intomainfrom
yuri-tseretyan/move-v0-integrations
Open

Move and integrate Receiver configuration#484
yuri-tceretian wants to merge 9 commits intomainfrom
yuri-tseretyan/move-v0-integrations

Conversation

@yuri-tceretian
Copy link
Collaborator

@yuri-tceretian yuri-tceretian commented Feb 12, 2026

Description

This pull request includes the following changes:

  • Relocated Receiver component to align with the updated architecture.
  • Updated all version 0 configurations to use the relocated HTTPClientConfig.
  • Added compatibility functions to the copied HTTPClientConfig.
  • Integrated receiver configurations and implementation migrated from the fork.

Checklist

  • Documentation has been updated, if necessary.
  • Unit and integration tests have been added or updated.
  • Changes have been tested locally.

Note

Medium Risk
Touches core receiver config types, HTTP client configuration, and integration construction/validation; regressions could break notification delivery or config compatibility across many integrations.

Overview
Switches PostableApiReceiver and related alertmanager definition/config plumbing from Prometheus config.Receiver to a new definition.Receiver that directly embeds Grafana v0mimir1 receiver config types, with stricter YAML validation (e.g., required receiver name).

Introduces a dedicated http/v0mimir1 HTTP client config package (plus compat converters to/from Prometheus common/config) and updates compat loading, merge/JSON handling, and Mimir validation to use this converted HTTP config for all v0 integrations.

Adds full upstream-compat conversion helpers (definition/compat/receiver_compat.go) and migrates Mimir integration building to Grafana v0mimir1 notifier implementations, including newly added jira support; tests and notify test helpers are updated accordingly, and dependencies are adjusted in go.mod/go.sum.

Written by Cursor Bugbot for commit 6762c52. This will update automatically on new commits. Configure here.

@yuri-tceretian yuri-tceretian requested a review from a team as a code owner February 12, 2026 21:32
@github-project-automation github-project-automation bot moved this to In review in Alerting Feb 12, 2026
@yuri-tceretian yuri-tceretian force-pushed the yuri-tseretyan/move-v0-integrations branch from 083b53b to d56bd27 Compare February 12, 2026 21:35
@cursor

This comment has been minimized.

Copy link
Contributor

@titolins titolins left a comment

Choose a reason for hiding this comment

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

A few minor comments, but wondering if the cursor bot comment (here) should also be addressed

Comment on lines +28 to +30
if c == nil {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

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

This shouldn't happen I believe but claude pointed out something here. On upstream, the default config will be returned in such cases here. Maybe we should do the same here

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 is a good point. The default config is set on config unmarshaller level. One thing makes me hesitate to change it is that this is a compatiblity layer: if somehow c is nil, it keeps the semantics. Changing would make this function to be in control what to return.
So, I think let's keep upstream the signle source of configs

Comment on lines +303 to +304
for i, c := range nc.JiraConfigs {
add("jira", i, c, func(l log.Logger) (notify.Notifier, error) { return jira_v0mimir1.New(c, tmpl, l, httpOps...) })
Copy link
Contributor

Choose a reason for hiding this comment

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

is there a reason for adding it back?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It did not exist in v0 configs :( I think we missed it. It exists in our cloud builder, though 🙈


// New returns a new Discord notifier.
func New(c *Config, t *template.Template, l log.Logger, httpOpts ...commoncfg.HTTPClientOption) (*Notifier, error) {
client, err := httpcfg.NewClientFromConfig(*c.HTTPConfig, "discord", httpOpts...)
Copy link
Contributor

Choose a reason for hiding this comment

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

Considering HTTPConfig could be nil, we might want to add a guard clause on the receivers' constructors (or guarantee never nil as mentioned here)

@cursor

This comment has been minimized.

@yuri-tceretian yuri-tceretian force-pushed the yuri-tseretyan/move-v0-integrations branch from c541864 to 8c36c72 Compare February 23, 2026 19:58
@cursor

This comment has been minimized.

@yuri-tceretian yuri-tceretian force-pushed the yuri-tseretyan/move-v0-integrations branch from d9402cd to 6762c52 Compare February 23, 2026 20:33
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is ON. A Cloud Agent has been kicked off to fix the reported issue.

if !ok {
return "", errors.New("not a v0mimir config type")
}
return itype, nil
Copy link

Choose a reason for hiding this comment

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

Integration type detection rejects non-v0 configs

Medium Severity

IntegrationTypeFromMimirTypeReflect no longer derives the integration type from struct names and instead requires the type to exist in v0integrationTypeToIntegrationType. Passing an upstream config.*Config (or any other struct not listed) now errors with “not a v0mimir config type”, which can break code paths still producing upstream receiver config types.

Additional Locations (1)

Fix in Cursor Fix in Web

@cursor
Copy link

cursor bot commented Feb 23, 2026

Bugbot Autofix prepared fixes for 1 of the 1 bugs found in the latest run.

  • ✅ Fixed: Integration type detection rejects non-v0 configs
    • Restored backward compatibility by first trying v0mimir map lookup and falling back to the original name-based derivation for upstream config types.

Create PR

Or push these changes by commenting:

@cursor push 5ba1981c3b
Preview (5ba1981c3b)
diff --git a/notify/schema.go b/notify/schema.go
--- a/notify/schema.go
+++ b/notify/schema.go
@@ -251,10 +251,10 @@
 	}
 	if t.Kind() == reflect.Struct {
 		itype, ok := v0integrationTypeToIntegrationType[t]
-		if !ok {
-			return "", errors.New("not a v0mimir config type")
+		if ok {
+			return itype, nil
 		}
-		return itype, nil
+		return IntegrationTypeFromString(strings.ToLower(strings.TrimSuffix(t.Name(), "Config")))
 	}
 	if t.Kind() == reflect.Ptr {
 		return IntegrationTypeFromMimirTypeReflect(t.Elem())

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In review

Development

Successfully merging this pull request may close these issues.

2 participants