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

Name context functions consistently #481

Merged
merged 2 commits into from
Feb 27, 2020

Conversation

krnowak
Copy link
Member

@krnowak krnowak commented Feb 14, 2020

It would be nice to follow a single schema for naming context
functions. In the trace package we followed the form FooFromContext
and ContextWithFoo. Do the same in the correlation package. The schema
WithFoo is mainly used for functions following the options pattern.

Not sure about a name of the NewContext function, though. For now I
have left it alone.

@krnowak krnowak force-pushed the consistent-function-naming branch from 02e476d to dd89378 Compare February 14, 2020 19:42
Copy link
Contributor

@jmacd jmacd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I support consistency. :-)

For the record: If you asked what I prefer, I think I'd prefer to see functions like CurrentMap(ctx) as opposed to MapFromContext(ctx), CurrentSpan(ctx) as opposed to SpanFromContext(ctx), ...

@krnowak
Copy link
Member Author

krnowak commented Feb 20, 2020

I support consistency. :-)

For the record: If you asked what I prefer, I think I'd prefer to see functions like CurrentMap(ctx) as opposed to MapFromContext(ctx), CurrentSpan(ctx) as opposed to SpanFromContext(ctx), ...

And CurrentRemoteSpanContext instead of RemoteSpanContextFromContext. Sounds ok as well to me. I'm fine with either. So getters could follow the CurrentFoo scheme. What about setters? They currently follow the ContextWithFoo scheme. Maybe SetCurrentFoo?

It would be nice to follow a single schema for naming context
functions. In the trace package we followed the form FooFromContext
and ContextWithFoo. Do the same in the correlation package. The schema
WithFoo is mainly used for functions following the options pattern.

Not sure about a name of the NewContext function, though. For now I
have left it alone.
@krnowak krnowak force-pushed the consistent-function-naming branch from dd89378 to c479226 Compare February 20, 2020 21:58
@krnowak
Copy link
Member Author

krnowak commented Feb 20, 2020

Heh, see #185 and #379. :)

@rghetia rghetia merged commit 8ebc7bb into open-telemetry:master Feb 27, 2020
@krnowak krnowak deleted the consistent-function-naming branch February 28, 2020 19:55
@pellared pellared added this to the untracked milestone Nov 8, 2024
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 this pull request may close these issues.

6 participants