-
Notifications
You must be signed in to change notification settings - Fork 250
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
Add Zipkin reporter #16
Add Zipkin reporter #16
Conversation
import logging | ||
import requests | ||
|
||
DEFAULT_ENDPOINT = '/api/v1/spans' |
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 you are using the new format, which would be /api/v2/spans openzipkin/zipkin-api#33
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.
Fixed, thanks!
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.
nice start!
if span_kind is not None: | ||
kind = SPAN_KIND_MAP.get(span_kind) | ||
# Zipkin API for span kind only accept | ||
# enum(CLIENT|SERVER|Absent) |
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.
also PRODUCER|CONSUMER but I don't think these exist in census..
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.
Added.
start_datetime = datetime.datetime.strptime( | ||
span.get('startTime'), | ||
ISO_DATETIME_REGEX) | ||
start_timestamp = calendar.timegm( |
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 suggest renaming start_timestamp
, end_timestamp
, and duration
to start_timestamp_ms
, end_timestamp_ms
and duration_ms
.
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.
Done.
start_datetime = datetime.datetime.strptime( | ||
span.get('startTime'), | ||
ISO_DATETIME_REGEX) | ||
start_timestamp_ms = calendar.timegm( |
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.
maybe suffix _us?
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.
Oops, is this milliseconds or microseconds? If microseconds, then my previous comment should indeed have been _us instead of _ms
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.
do you have a test app we can use? ex https://github.com/openzipkin/pyramid_zipkin-example
""" | ||
local_endpoint = { | ||
'serviceName': self.service_name, | ||
'ipv4': self.host_name, |
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.
ipv4 or ipv6 needs to be an ip literal, not a host_name. need to sanity check this
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.
Yes, we need system tests for all these.
Send spans to Zipkin server. Tested using docker running locally which starts a Zipkin server to collect traces. Link to Zipkin API document: http://zipkin.io/zipkin-api