Skip to content

level of integration with golang.org/x/net/context.Context #156

Closed

Description

@stevvooe

Some work has begun in integrating golang.org/x/net/context, such as #151. Most of this has been done with an eye on logging. Specifically, we are effectively using the context to inject loggers into disparate parts of the application.

  1. To what extent do we have the stable APIs integrate context? For example, do we have every method start with context or do we have objects that can be created with a context use a given context.
  2. Where do we draw the line for injection using the context? It seems to make sense with loggers and maybe authentication credentials, but where do we draw this line? Do we define rules?
  3. Where should it be acceptable to create new contexts? Does this only happen at request time? Or should arbitrary method calls be able to take and return a new context?
  4. Is this even a good idea? Where are the dragons?

Please respond with commentary.

Activity

  1. stevvooe commented on Feb 10, 2015

    @stevvooe
    CollaboratorAuthor
  2. ncdc commented on Feb 23, 2015

    @ncdc

    Sorry for the delay in commenting. I think it's ok for methods to take in a Context as the first parameter.

  3. ncdc commented on Feb 23, 2015

    @ncdc

    Having said that, I've been working on other tasks and am just now getting back to working on integrating the v2 registry into OpenShift. I'll have some more comments as I dig through the code.

  4. icecrime commented on Feb 26, 2015

    @icecrime

    FWIW, we considered using golang.org/x/net/context in the past for some pieces of the network plugins, and it does sound like a good idea. However, our initial intention was to either recode it (it's small enough) or wrap it to avoid being locked on a third party which appears in each and every of our methods signatures.

  5. stevvooe commented on Feb 26, 2015

    @stevvooe
    CollaboratorAuthor

    @icecrime What if we duplicated the declaration in distribution/context? For now, I say we go full hog, as the benefits are great, with the caveat that we change the source of the definition. Ultimately, they will be cross-compatible.

    The other option is this:

    type Context interface {
        golang.org/x/net/context.Context
    }
    

    Then use that everywhere.

  6. icecrime commented on Feb 26, 2015

    @icecrime

    I don't have a clear preference, I guess both work.

  7. self-assigned this
    on Mar 10, 2015
  8. stevvooe commented on Mar 14, 2015

    @stevvooe
    CollaboratorAuthor

    We are going to integrate google context throughout. While requiring context everywhere is "ugly", the benefits are clear.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions