GithubHelp home page GithubHelp logo

pyramid_zipkin's People

Contributors

acer618 avatar arnaudbrousseau avatar asottile avatar benbariteau avatar bplotnick avatar cklein avatar dmfallak avatar drolando avatar kaisen avatar khunglongcubu avatar lorinbeer avatar msindwan avatar nhandler avatar prat0318 avatar sjaensch avatar thebostik avatar yaroliakh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pyramid_zipkin's Issues

pre-commit hooks don't work

There's a few issues with pre-commit config right now.

The first is that when you run pre-commit with the current .pre-commit-config.yaml, you get that the sha is invalid. We should just use a version number in the sha field anyway.

The second is that there are a number issues that pre-commit catches when you run with --run-all, which mainly tells me that we should run "pre-commit run --all-files" in travis.

IPv6 support

We currently support logging of only IPv4 addresses. Starting with Zipkin 1.4 endpoints can omit IPv4 (by setting Endpoint.ipv4 to 0), and optionally log Endpoint.ipv6 as the raw 16byte address.
https://github.com/openzipkin/zipkin-api/blob/master/thrift/zipkinCore.thrift#L276

In json, both are the string formatting http://zipkin.io/zipkin-api

ipv4:
string
The text representation of a IPv4 address associated with this endpoint. Ex. 192.168.99.100
ipv6:
string
The text representation of a IPv6 address associated with this endpoint. Ex. 2001:db8::c001

API for adding binary annotations

Users of the pyramid-zipkin library might want to add custom annotations. Currently there is a workaround by logging messages in a certain format to the "pyramid_zipkin.logger" log. However, it'd be nice if instead the user could call something like pyramid_zipkin.add_custom_annotation({'blah': 'foo'}).

invalid trace and span ids when always_emit_zipkin_headers is False

If always_emit_zipkin_headers is set to False and the current request is not traced, create_zipkin_attr returns a ZipkinAttr with empty trace and span ids.

If firehose is enabled this breaks py_zipkin as those ids are invalid. The always_emit_zipkin_headers should only control setting trace_id in the request object and nothing else.

Batch all service annotations together

Adding an annotation like so:

zipkin_logger.debug({'annotations': {'start_db_call': time.time()}})

results in warning in Collector console:

19:00:58.772 [pool-2-thread-2] WARN  o.t.z.storage.cassandra.Repository - Span 1_547073285_-1325006353 in trace 4848644533043884200 had no timestamp. If this happens a lot consider switching back to SizeTieredCompactionStrategy for zipkin.traces

This is because the above debug creates a new span message with no cs, cr OR ss, sr pair. These spans can be merged with the service span created here. (by getting all non-client spans from the loop and getting the annotations and binary annotations out).

Also, we should mention in the docs that the client spans SHOULD contain cs, cr pair.

Test against python3.5

This will require some changing of the Makefile and .travis.yml files to make sure they use tox >= 2.

should_not_sample_route and should_not_sample_path should not override X-B3-Sampled

With the current logic paths and routes that are blacklisted won't generate a span (and actually interrupt the trace at that point) even if the trace is being sampled. Imo that's not what we usually want.

We usually blacklist paths like /status, /swagger.json or /status/metrics. We do that because we don't want healthchecks and other automated calls to be traced.
But imo if we're in the middle of a trace I'm interested to know if my code is calling the status endpoint of another service and spending time on that.

@adriancole @bplotnick thoughts?

Report span.timestamp and duration

While possible to derive a span's timestamp and duration at query time, it is best to report them to zipkin. This reduces the guesswork on the server side, and particularly makes the cassandra storage implementation more effective. This also makes the duration query operable.

Do we need to do anything?

First, we'd need to report span.timestamp and duration in the first place :) This might start with an upstream change to py_zipkin to capture this. Here's the normal doc on that zipkin.io/pages/instrumenting.html

Then, we'd need to ensure that the special-case of continuing a client-originated span on the server is addressed (where B3 headers are read).

Here are tests that should be in place to ensure that span.timestamp and duration are set properly.

  • client creates a span and propagates it to a server

    • client propagates b3 headers for trace id, span id, and sampled=1
    • server neither reports span.timestamp nor duration
    • client reports span.timestamp and duration
  • server creates a new trace

    • no b3 headers are detected
    • server reports span.timestamp and duration
  • server creates a new trace with externally supplied ids

    • caller propagates b3 headers for trace id, span id, but no sampled header
    • server reports span.timestamp and duration

Does this make sense? Can anyone here help implement this?

See openzipkin/brave#277 (comment)

Make it compatible with gevent

In gevent, threading_local always creates a new object and scraps of requests attribute attached to it during module load

Reassign empty list if attribute is not found attached.

Add request.matched_route binary annotation

This pyramid construct is often different than the http.uri annotation we include by default.

In addition to this it'd be kinda cool to allow users to turn binary annotations added by default on/off. Something like setting a 'default_binary_annotations' list in the pyramid registry. Just an idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.