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

Ability to replay/paste trace/spans? #159

Open
ddebrunner opened this issue Dec 13, 2024 · 4 comments
Open

Ability to replay/paste trace/spans? #159

ddebrunner opened this issue Dec 13, 2024 · 4 comments

Comments

@ddebrunner
Copy link

Very nice tool.

I came across otel-desktop-viewer in seeing if I could save a trace or a set of spans in JSON and then visualize it offline.

What otel-desktop-viewer does with its sample data seems to be 90% of the way there, but I would instead like to upload a file or paste a JSON representation of spans.

An alternative would be to just use a replay tool that consumes a JSON file containing the spans and sends to the collector which then could be seen by otel-desktop-viewer. I thought otel-cli might do this, but I'm not seeing any option like that.

So wondering if there were other ideas ...

@jmorrell
Copy link
Collaborator

Given that there's a JSON file type in the spec https://opentelemetry.io/docs/specs/otel/protocol/file-exporter/#json-lines-file it might make sense to add that as a feature. That seems fairly new / under development and I wasn't really able to find any tooling around that file format though.

@jmorrell
Copy link
Collaborator

Though it looks like the ptrace library might be able to parse that. Honeycomb uses it here https://github.com/honeycombio/otel-file-importer/blob/main/main.go#L133

That should make a CLI tool that replays it quick to build, but it's also something we could try building into this tool after the duckdb migration @CtrlSpice

@ddebrunner
Copy link
Author

Thanks @jmorrell for responding, especially the link to the JSON spec which I didn't find.

I was using the file exporter to produce JSON and that seems to be aligned with that spec.
https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/exporter/fileexporter

I think I could always setup another collector that has file importer to read the JSON and then exports to a different collector using http, though that's a bit heavy weight for what I was thinking about. I haven't tried this at all though.

@ddebrunner
Copy link
Author

curl to the rescue!

Save the trace in its JSON format and then curl into the collector.

curl -H "Content-Type: application/json" \
  -d @trace.json \
  http://localhost:4318/v1/traces

Thanks to: https://stackoverflow.com/questions/72719361/send-traces-to-opentelemetry-collector

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

No branches or pull requests

2 participants