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

Add Zipkin reporter #16

Merged
merged 8 commits into from
Aug 16, 2017
Merged

Conversation

liyanhui1228
Copy link
Contributor

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

@liyanhui1228 liyanhui1228 requested a review from duggelz August 15, 2017 01:10
import logging
import requests

DEFAULT_ENDPOINT = '/api/v1/spans'

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed, thanks!

Copy link

@codefromthecrypt codefromthecrypt left a 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)

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..

Copy link
Contributor Author

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(
Copy link

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.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@liyanhui1228 liyanhui1228 merged commit 146627e into census-instrumentation:master Aug 16, 2017
start_datetime = datetime.datetime.strptime(
span.get('startTime'),
ISO_DATETIME_REGEX)
start_timestamp_ms = calendar.timegm(

Choose a reason for hiding this comment

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

maybe suffix _us?

Copy link

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

Copy link

@codefromthecrypt codefromthecrypt left a comment

Choose a reason for hiding this comment

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

"""
local_endpoint = {
'serviceName': self.service_name,
'ipv4': self.host_name,

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

Copy link

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.

@liyanhui1228 liyanhui1228 deleted the zipkin branch August 23, 2017 21:08
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.

3 participants