Skip to content

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

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

alexander-akhmetov
Copy link

@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>
@alexander-akhmetov alexander-akhmetov force-pushed the alexander-akhmetov/webhook-timeout-type branch from 0545aa5 to 1c49704 Compare June 11, 2025 10:09
@alexander-akhmetov alexander-akhmetov marked this pull request as ready for review June 11, 2025 10:17
@alexander-akhmetov alexander-akhmetov marked this pull request as draft June 11, 2025 17:31
@alexander-akhmetov alexander-akhmetov marked this pull request as ready for review June 11, 2025 19:50
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.

1 participant