Skip to content

Use model.Duration for timeout option in webhook notifier#4430

Closed
alexander-akhmetov wants to merge 1 commit into
prometheus:mainfrom
alexander-akhmetov:alexander-akhmetov/webhook-timeout-type
Closed

Use model.Duration for timeout option in webhook notifier#4430
alexander-akhmetov wants to merge 1 commit into
prometheus:mainfrom
alexander-akhmetov:alexander-akhmetov/webhook-timeout-type

Conversation

@alexander-akhmetov
Copy link
Copy Markdown

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

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 force-pushed the alexander-akhmetov/webhook-timeout-type branch from 1bf359d to 0545aa5 Compare June 11, 2025 10:03
Signed-off-by: Alexander Akhmetov <me@alx.cx>
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