agardnerIT / tracepusher

Generate and push OpenTelemetry Trace data to an OTEL collector in JSON format
Apache License 2.0
53 stars 11 forks source link

HAR to OTEL trace #72

Closed agardnerIT closed 8 months ago

agardnerIT commented 1 year ago

Build a HAR to OTEL trace tool

agardnerIT commented 8 months ago

It is taking shape...

This will require a new flag in tracepusher which allows users to specify a custom start time. This is something @Dant3s discussed a while ago. A HAR downloaded a month ago will thus result in a trace being sent with a start time of "a month ago" (be aware because you'll need to search for that in your backend).

All pertinent request / request information will be able to be added as span attributes.

It is anticipated that there will be flags to enable / disable verbose items like headers and cookies (which could blow up your backend storage) - so we give you the option of sending or not.

Screenshot 2023-12-23 at 5 10 40 pm
agardnerIT commented 8 months ago

Edit: Documentation is here.

Alpha version available for testing!

  1. Save a .har file into a directory
  2. From that directory, adjust the command below and run

Notes

  1. host.docker.internal points to your localhost so this command assumes your OpenTelemetry collector is running on http://localhost:4318 (adjust as necessary)
  2. The service name defaults to har-to-otel but can be configured with --service-name my-service-name
  3. Flag: --timings false|true will add / remove timing information as span attributes (default: true)
  4. Flag: --request-headers true will add request headers as span attributes (default: false)
  5. Flag: --response-headers true will add response headers as span attributes (default: false)
  6. Flag: --request-cookies true will add request cookies as span attributes (default: false)
  7. Flag: --response-cookies true will add response cookies as span attributes (default: false)
  8. Flag: --debug true enables debug mode
  9. Flag: --dry-run true enables dry run mode

Try it...

docker run \
  --mount type=bind,source="$(pwd)",target=/files \
  gardnera/har-to-otel:dev \
  -f /files/YOUR-HAR-FILE.har \
  -ep http://host.docker.internal:4318 \
  --insecure true
Screenshot 2023-12-24 at 11 49 53 am

Code

Code is available here

agardnerIT commented 8 months ago

This issue has had significant traffic and views. No reports of broken functionality. HAR to OTEL tool will be released w/ tracepusher v0.10.0 and will always be released alongside tracepusher. Therefore, the first version of the HAR to OTEL tool will be 0.10.0