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

Integrate Tracing (derived from OpenTelemetry) #15

Open
CMCDragonkai opened this issue Jul 19, 2022 · 4 comments
Open

Integrate Tracing (derived from OpenTelemetry) #15

CMCDragonkai opened this issue Jul 19, 2022 · 4 comments
Labels
development Standard development r&d:polykey:supporting activity Supporting core activity

Comments

@CMCDragonkai
Copy link
Member

CMCDragonkai commented Jul 19, 2022

Specification

OpenTelemetry is an overly complicated beast. It's far too complex to adopt into a logging system. However the basic principles of tracing makes sense. Here I'm showing how you can set one up for comparison testing, for us to derive a tracing schema and later visualise it ourselves or by passing it into an OTLP compatible visualiser.

docker run -d --name jaeger \
  -e COLLECTOR_ZIPKIN_HOST_PORT=:9411 \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 6831:6831/udp \
  -p 6832:6832/udp \
  -p 5778:5778 \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  -p 14250:14250 \
  -p 14268:14268 \
  -p 14269:14269 \
  -p 9411:9411 \
  jaegertracing/all-in-one:1.36

The above command runs jaeger. Take note of 4318 port which is the OTLP protocol over HTTP.

Visit localhost:16686 to be able to view the jaeger system.

Then any example code, like for example https://github.com/open-telemetry/opentelemetry-js/blob/main/examples/basic-tracer-node/index.js can run and push traces directly to the docker container.

What is frustrating is:

  1. OpenTelemetry code only exports to stderr as an afterthought, it's not considered first class usage
  2. The stderr exporters output via console.log and produce pretty printed results that are not actual JSON. Thus you cannot just pipe it to a relevant location.
  3. The schema of the span data isn't clear, it seems different parts of the documentation still have old data, or maybe the JS implementation itself is hasn't been updated to the new schema.

The plan:

  1. Create your own "span" derived from opentelemetry and output as just regular structured JSON
  2. Massage it to be compatible to open telemetry viewers like jaeger
  3. Use jaeger's 4318 to stream the JSON and view data in the interim
  4. Find an easier way to visualise traces, maybe something that can be used CLI or in the GUI
  5. For production usage, feed to any structured log capturer, and then feed into a viewer that understands trace information

Additional context

Tasks

  1. ...
  2. ...
  3. ...
@CMCDragonkai CMCDragonkai added the development Standard development label Jul 19, 2022
@CMCDragonkai
Copy link
Member Author

It seems alot of the complexity is due to the vendors fragmentation and they are trying to make everything compatible.

@CMCDragonkai CMCDragonkai mentioned this issue Jul 19, 2022
15 tasks
@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Jul 19, 2022

Most tracing tools like https://nodejs.org/api/tracing.html and chrome:://tracing expect a finite dataset, that is expected that a trace has a beginning and end. That's why it's always been "request" driven. Open telemetry is just deriving stuff that came before like in https://github.com/gaogaotiantian/viztracer https://github.com/janestreet/magic-trace https://github.com/kunalb/panopticon and more.

I'm interested in more than just request-driven tracing but live infinite traces (call it continuous tracing that shows finished and live spans at the same time), and correlates them too. I'm guessing we need zoomable levels of detail the ability to filter out irrelevant information dynamically.

Open telemetry in particular does not appear to emit a span until it is done. I'd imagine knowing when a span started even if it did not end yet would be useful for live continuous tracing.

@CMCDragonkai CMCDragonkai added r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices discussion Requires discussion bug Something isn't working design Requires design documentation Improvements or additions to documentation duplicate This issue or pull request already exists enhancement New feature or request invalid This doesn't seem right question Further information is requested research Requires research wontfix This will not be worked on help wanted procedure ops and removed r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices labels Jul 23, 2022
@CMCDragonkai CMCDragonkai added r&d:polykey:supporting activity Supporting core activity and removed documentation Improvements or additions to documentation design Requires design duplicate This issue or pull request already exists discussion Requires discussion epic enhancement New feature or request invalid This doesn't seem right r&d:polykey:core activity 4 End to End Networking behind Consumer NAT Devices r&d:polykey:core activity 3 Peer to Peer Federated Hierarchy r&d:polykey:core activity 1 Secret Vault Sharing and Secret History Management procedure good first issue ops security wontfix This will not be worked on question Further information is requested r&d:polykey:core activity 2 Cross Platform Cryptography for JavaScript Platforms research Requires research production equipment labels Jul 23, 2022
@CMCDragonkai
Copy link
Member Author

Here's an old blog post demonstrating the integration of opentracing to an ES6 promise.

This code is quite outdated, as can be seen by our initial experiments with opentracing, the tracing format isn't exactly what we want, since the spans are only output at the very end, and is not conducive to both live and infinite/non-terminating visualisation.

However the code does show that at one point opentracing was simple enough to be easily extended upon, and one just uses the opentracing core library rather than bringing in so many dependencies now.

@CMCDragonkai
Copy link
Member Author

CMCDragonkai commented Nov 18, 2022

What we want is something like this:

tracing_viz

The tracing goes from top to bottom, and represents an "infinite" live visualisation of what the current state (lifecycles) of the system is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Standard development r&d:polykey:supporting activity Supporting core activity
Development

No branches or pull requests

1 participant