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

amtool silence duration flag always calculates from current time even when --start time is specified #2490

Closed
ktower opened this issue Feb 24, 2021 · 0 comments · Fixed by #2741

Comments

@ktower
Copy link

ktower commented Feb 24, 2021

What did you do?
When creating a new silence in the future using amtool with the --start and --duration flags, the end date/time is calculated from the current time rather than the specified start time. See:

endsAt = time.Now().UTC().Add(time.Duration(d))

What did you expect to see?
End date/time for a new silence to be calculated from the time specified by the --start flag.

What did you see instead? Under which circumstances?
End date/time is always calculated from the current time. This is particularly notable when the --start time is more than --duration in the future, such as this example run at approximately 2021-02-24T14:00:00Z:

# amtool silence add alertname=testing --start=2021-02-24T23:00:00Z --duration=30m --comment=testing
amtool: error: silence cannot start after it ends

Environment

  • System information:

    Linux 5.4.0-65-generic x86_64

  • Amtool version:

amtool, version 0.21.0 (branch: HEAD, revision: 4c6c03e)
build user: root@dee35927357f
build date: 20200617-08:54:02
go version: go1.14.4

(binary provided in unmodified quay.io/prometheus/alertmanager:v0.21.0 container)

Note: While I am not a golang programmer, if the maintenance team deems this to be a valid issue I might be interested enough to learn it so that I could contribute to the project.

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 a pull request may close this issue.

1 participant