prometheus-community / pro-bing

A library for creating continuous probers
MIT License
291 stars 49 forks source link

Resolve with parent context #99

Open anisse opened 3 months ago

anisse commented 3 months ago

To have proper cancellation, it would help to do all name resolution using the net.Resolver.LookupIP, which takes a context. It's already in use since version 0.4.0, but it uses context.Background as a base, not the context passed to RunWithContext. It would remove surprises like those in #64.

It would be a behaviour change, but not a very surprising one, and IMHO much less annoying than adding other APIs like ResolveWithContext and RunWithContextAndResolveWithContext.

Would you be open to such a PR?