Skip to content

Conversation

@alexander-akhmetov
Copy link

@alexander-akhmetov alexander-akhmetov commented Jun 13, 2025

Upstream PR: prometheus#4430

Should be safe to apply because yaml format does not change.

Copied description:

Changed webhook timeout field from time.Duration to model.Duration to make JSON marshalling consistent with YAML.

time.Duration marshals to JSON as an integer (nanoseconds), while to YAML (with gopkg.in/yaml.v3) it's marshalled as a duration string.

time.Duration example: https://go.dev/play/p/Ml2Mb_VFNyu:

JSON: {"timeout":90000000000}
YAML: timeout: 1m30s

model.Duration also marshals to human-readable duration strings in both JSON and YAML, and is consistent with other duration fields in Alertmanager.

model.Duration example: https://go.dev/play/p/rqts9yDSEQL

JSON: {"timeout":"1m30s"}
YAML: timeout: 1m30s

@alexander-akhmetov alexander-akhmetov marked this pull request as ready for review June 19, 2025 14:34
@alexander-akhmetov alexander-akhmetov requested a review from a team as a code owner June 19, 2025 14:34
@alexander-akhmetov alexander-akhmetov merged commit be61a67 into main Jun 20, 2025
12 checks passed
stevesg pushed a commit to grafana/mimir that referenced this pull request Jun 27, 2025
#### What this PR does

Update grafana/alerting and grafana/prometheus-alertmanager modules.

[grafana/alerting
diff](grafana/alerting@3e20fda...863b097):
- grafana/alerting#347
- grafana/alerting#348
- grafana/alerting#349
 
[grafana/prometheus-alertmanager
diff](grafana/prometheus-alertmanager@92c8f63...be61a67):
- grafana/prometheus-alertmanager#117

The main change is the change of `WebhookConfig.Timeout` type from
`time.Duration` to `model.Duration` to make marshalling to JSON and YAML
the same. It does not affect YAML marshalling, only JSON and is needed
for Grafana so in the future it can start sending JSON encoded
configurations with alertmanager receivers. More details are in
grafana/prometheus-alertmanager#117

#### Checklist

- [ ] Tests updated.
- [ ] Documentation added.
- [ ] `CHANGELOG.md` updated - the order of entries should be
`[CHANGE]`, `[FEATURE]`, `[ENHANCEMENT]`, `[BUGFIX]`. If changelog entry
is not needed, please add the `changelog-not-needed` label to the PR.
- [ ]
[`about-versioning.md`](https://github.com/grafana/mimir/blob/main/docs/sources/mimir/configure/about-versioning.md)
updated with experimental features.
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.

2 participants