Giter VIP home page Giter VIP logo

zipkin-javascript-opentracing's Introduction

Zipkin-Javascript-Opentracing Build Status Coverage Status

Installation

Run npm install --save zipkin-javascript-opentracing to install the library.

For usage instructions, please see the examples in the examples/ directory. There is a basic vanilly javascript example that shows how to use the tracer in the context of a single express server and there is an advanced vanilla javascript example that shows how multiple services (express API and frontend) might interact and share a tracing context.

Limitations

injecting and ejecting

We currently only support HTTP Headers. If you need your own mechanism, feel free to do a PR. Also we assume that you only inject the HTTP Headers once, otherwise we will send multiple ClientSend annotations for you.

Also you can only finish spans which were not extracted. If you like this behaviour to be different, please open an issue.

Flags

They are currently not supported, feel free to do a PR.

Follows From (zipkin)

FollowsFrom is not supported by openTracing, as far as I understand.

Additional options for starting a span

We need to know if this is a server or client to set the right annotations. Therefore we need the kind attribute to be set.

Example

All examples need to run zipkin on "localhost:9411". This is best achieved by using docker:

docker run -d -p 9411:9411 openzipkin/zipkin

Basic

To see how to use this library with only one service see examples/vanillajs/basic. You can run the example with npm run example:basic.

Advanced

In order to see how different services may pick up spans and extend them, please see the advanced example at examples/vaniallajs/advanced. You can run the example with npm run example:advanced.

zipkin-javascript-opentracing's People

Contributors

antoinetissier avatar ashishmahi avatar awitherow avatar danielmschmidt avatar dependabot[bot] avatar koenpunt avatar kpruden avatar moocar avatar nicolai86 avatar petermetz avatar renovate[bot] avatar

Stargazers

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

Watchers

 avatar  avatar

zipkin-javascript-opentracing's Issues

Stabilize tests

We currently have flaky E2E tests, because zipkin is an external system we interact with. There are some ways to imrpove this situation:

  • Poll for a specific span name instead of randomly waiting two seconds
  • Use a very specific / unique string as span name e.g. firstSpan-${+new Date()}
  • To make the above possible we might use a text input in the web, we can automate it with .type

Fix CI

Currently jenkins is red on master, we need to fix this by adding the right environment variables.

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

Rate-Limited

These updates are currently rate-limited. Click on a checkbox below to force their creation now.

  • chore(deps): update dependency serve to v6.5.8
  • chore(deps): update dependency babel-preset-env to v1.7.0
  • chore(deps): update dependency node-fetch to v2.7.0
  • chore(deps): update dependency cypress to v13
  • chore(deps): update dependency husky to v9
  • chore(deps): update dependency lint-staged to v15
  • chore(deps): update dependency node-fetch to v3
  • chore(deps): update dependency nodemon to v3
  • chore(deps): update dependency prettier to v3
  • chore(deps): update dependency serve to v14
  • fix(deps): update dependency react-scripts to v5
  • fix(deps): update react monorepo to v18 (major) (react, react-dom)
  • ๐Ÿ” Create all rate-limited PRs at once ๐Ÿ”

Edited/Blocked

These updates have been manually edited so Renovate will no longer make changes. To discard all commits and start over, click on a checkbox.

Open

These updates have all been created already. Click a checkbox below to force a retry/rebase of any.

Detected dependencies

npm
e2e-tests/react/package.json
  • opentracing 0.14.3
  • react 16.3.1
  • react-dom 16.3.1
  • react-scripts 1.1.4
  • zipkin 0.10.1
  • zipkin-transport-http 0.10.1
  • babel-polyfill 6.26.0
  • cypress 3.8.2
  • node-fetch 2.1.2
  • serve 6.5.5
package.json
  • babel-cli 6.26.0
  • babel-preset-env 1.6.1
  • coveralls 3.0.0
  • express 4.16.3
  • husky 0.14.3
  • jest 22.4.3
  • lint-staged 7.0.4
  • nodemon 1.17.3
  • opentracing 0.14.3
  • prettier 1.12.0
  • zipkin 0.10.1
  • zipkin-transport-http 0.10.1
  • opentracing *
  • zipkin >=0.10.1
  • zipkin-transport-http >=0.10.1
website/package.json
  • docusaurus 1.0.10

  • Check this box to trigger a request for Renovate to run again on this repository

Support for `followsFrom` references

Hi,

In the Javascript API of OpenTracing, function followsFrom allows to create a reference that can be passed as SpanOption when starting a span.

However, in this repo, references do not seem to be supported. Is there any plan on supporting them in the future ?

Thanks,
Antoine

Support for `Span.context()`

Hi,

Method span.context() from the OpenTracing API reference does not seem to be supported. Is there any plan on supporting it anytime soon ?

The goal ultimately is to use it to get the span's id and trace id through span.context().toSpanId() and span.context().toTraceId(). Is there maybe another way to get them ?

Thanks a lot,
Antoine

Sampler rate for tracer

Hello,

I am using this library in a react project and i am trying to work it in client side. But i can not apply sampler rate for my requests. When i am searching for the library i see these lines.

this._zipkinTracer = new Tracer({
      ctxImpl: new ExplicitContext(),
      recorder: options.recorder
    });
    this._Span = SpanCreator({
      tracer: this._zipkinTracer,
      serviceName: this._serviceName,
      kind: options.kind,
      sampler: options.sampler
    });

Here, sampler is only applied for span, not for tracer. Why ?

Thanks for your help.

Kerim

Is "kind" only set per tracer, globally?

Hi,
I'm testing your module in one of our "API gateways", acting like "smart HTTP proxies", and I'm curious if it's possible to log some spans as server and some spans as client?
As I understand now the "kind" option is only set per tracer object, so HTTP requests the api gateway is making itself are also marked as "server". But they should be marked as "client".
Is it currently possible?

Support for logs to be sent as separate entity, not same as tags

We already have method SetTag which add tags as key value and send it back to collector. I found that you have log method which rather than logging message string sends them as tag which i found is wrong. one way we already have a method which can add tags so log should be doing actual logging.. not adding tags again. that way library will have both way to add tags and add logs separately. however i found that the core tracer which you are using here has already method to log separately. the method is recordMessage. so if you can use that when log is being called, then you would have support for logs as well.

I'll anyway raise PR for it. but you can comment here your thoughts.

Warnings with require statement

Thanks for the great work on this repo. Currently I use typescript, webpack and when using the lib it generates the two following warning.

WARNING in ./node_modules/zipkin/lib/InetAddress.js 62:23-30 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted @ ./node_modules/zipkin/lib/index.js @ ./node_modules/zipkin-javascript-opentracing/lib/index.js @ ./src/index.tsx

WARNING in ./node_modules/zipkin-transport-http/lib/HttpLogger.js 17:27-34 Critical dependency: require function is used in a way in which dependencies cannot be statically extracted @ ./node_modules/zipkin-transport-http/lib/index.js @ ./node_modules/zipkin-javascript-opentracing/lib/index.js @ ./src/index.tsx

Everything seems working fine though, traces are sent to zipkin and no crash when running the app. Because there is no .d.ts contains I neeeded to do const ZipkinOpentracing = require('zipkin-javascript-opentracing')instead of import ZipkinOpentracing from 'zipkin-javascript-opentracing'. Not an expert and don't know if it will resolve the issue and make the warnings dissaper but I read a lot about webpack and errors with require().

Support required carrier formats for inject/extract

According to the spec all opentracing implementations are required to support the text_map and binary carrier format. This implementation seems to support only its internally-defined FORMAT_HTTP_HEADERS format. It turns out this is good enough for me, but the value defined for this constant differs from that in the standard javascript library.

To avoid explicit dependencies on Zipkin in my application code, I'm using the constants defined in the reference library. For my purposes it would be sufficient if the value you define for this constant matches that in the standard library (http_headers)

Enable local spans

There is a type of span in zipkin that does not resemble a client request or a server request. We should therefore introduce the kind "local" to do this. The current implementation is documented here: openzipkin/zipkin-js#104

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.