-
Notifications
You must be signed in to change notification settings - Fork 702
api: change order of arguments in add_event #270
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
api: change order of arguments in add_event #270
Conversation
e4d8949 ("OpenTracing Bridge - Initial implementation (open-telemetry#211)") introduced a new timestamp argument to the add_event method. This commit moves that argument to be the last one because it is more common to have event attributes than an explicitly timestamp.
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.
The changes LGTM, but adding a few lines to test_span_members
pushed it over the threshold for pylint to raise a too-many-statements
.
We may want to disable this check eventually, but I think pylint is right in this case: this test would benefit from being broken up.
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.
+1 on doing something to break up the tests vs removing the linting. But LGTM! Assuming that gets fixed approved.
@@ -75,7 +75,7 @@ def log_kv(self, key_values, timestamp=None): | |||
event_timestamp = None | |||
|
|||
event_name = util.event_name_from_kv(key_values) | |||
self._otel_span.add_event(event_name, event_timestamp, key_values) | |||
self._otel_span.add_event(event_name, key_values, event_timestamp) |
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'd personally use explicit param names here, in order to be on the safe side (in case we change order in the future ;) )
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.
Actually having the parameters by position could be good because it can be a reminder that if the position is changed something could break.
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.
Thanks @mauriciovasquezbernal, LGTM!
The flask integration has (only) two advantages over the plain WSGI middleware approach: - It can use the endpoint as span name (which is lower cardinality than the route; cf #270) - It can set the http.route attribute. In addition, it also has an easier syntax to enable (you don't have to know about Flask.wsgi_app).
e4d8949 ("OpenTracing Bridge - Initial implementation (#211)") introduced
a new timestamp argument to the add_event method. This commit moves that
argument to be the last one because it is more common to have event attributes
than an explicitly timestamp.