-
Notifications
You must be signed in to change notification settings - Fork 56
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
Introduce setTag method for a Span interface and get rid of setTags #52
Conversation
src/OpenTracing/Span.php
Outdated
* a string, a boolean value, or a numeric type. | ||
* Adds a tag to the span. | ||
* | ||
* If there is a pre-existing tag set for key, is is overwritten. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is a typo here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch. Fixed.
ping @tedsuo @beberlei @yurishkuro |
Having setTags instead of setTag means that you would have to be aware of tags that are set in order to add aditional tag to a span. But that is not the case if we expose an interface to set just a single tag. All other opentracing libraries also have setTag exposed instead of setTags so this helps to have more consistency between libraries. Closes #51
I am fine with the change, but not sure I follow its reasoning. Isn't |
@yurishkuro For a sake of argument lets assume that public function setTags(array $tags)
{
$this->tags = $tags;
} Meaning it will not preserve original tags that were set before and will overwrite with new ones. On the other hand, public function setTag($key, $value)
{
$this->tags[$key] = $value;
} So as a user I am able to add a new tag to existing tag collection without knowing all previously set tags. |
Fair enough |
The intention behind |
Having setTags instead of setTag means that you would have to be aware of tags that are set in order to add aditional tag to a span. But that is not the case if we expose an interface to set just a single tag.
All other opentracing libraries also have setTag exposed instead of setTags so this helps to have more consistency between libraries.
Closes #51