-
Notifications
You must be signed in to change notification settings - Fork 53
Introduce context method parameters #278
Comments
Oh hey, I was looking at this today. One idea I had was we could add new methods that accept context and lace it through the code, and provide the current API via wrappers that simply add context.Background(). e.g. func DoThingCtx(ctx context.Context, arg1 string) error {}
func DoThing(arg1 string) error {
return DoThingCtx(context.Background(), arg1)
} In my case, this would allow for OpenTelemetry trace & span propagation through the library for everyone that uses context. |
@displague @tobert Hi, I'm adding my 2 cents. I'm pro introducing context methods. I am against waiting for swagger generated client. Pairing
We might need the context functions for terraform provider at some point, the basic CRUD functions are mentioned as "deprecated" in the TK SDK: I can start working on this if you want. I'd first create a context client, pick one simple service (maybe projects), and adapted to context methods as @tobert wrote. We could then iterate how it looks, and see how to proceed. |
@t0mk this client isn't really my area of focus but if you want to take a swing I'd be happy to help review & champion. A bunch of internal Metal uses of packngo would benefit from context passing as well. |
Playing devil's advocate for a moment, we are still in If we do, I'm sure third-party integrators will step into this on their next |
The packngo library does not currently allow for context deadlines to be used in requests.
https://blog.golang.org/context-and-structs
More at https://blog.golang.org/context
What would it look like to add Context to packngo at this time?
The text was updated successfully, but these errors were encountered: