prometheus-community / pro-bing

A library for creating continuous probers
MIT License
309 stars 52 forks source link

Allow stopping a running ping with a Context #14

Open sector-f opened 1 year ago

sector-f commented 1 year ago

It could be helpful if there were a method like *Pinger.Run() that accepted a Context for cancellation. Would this be difficult to add given the current implementation?

TheRushingWookie commented 1 year ago

Hi I'd be interested in adding support for this. Would you guys be open to me adding a PR for it?

It'd look like

The API would look like:

func (p *Pinger) Run(ctx context.Context) error 
TheRushingWookie commented 1 year ago

This is implemented in https://github.com/prometheus-community/pro-bing/pull/29