equinix-labs / equinix-labs/otel-cli

implement server spool to disk & replay

Open
#203 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Go
Stars
718
Forks
59
PR merge metrics
No merged PRs in 30d

Description

Via some discussion in #183: It might be useful to have otel-cli be able to write spans to disk, and then replay them. This can be handy in scenarios when the network/collector aren't available when the traces are generated, but will be later.

Also creates a path for having containers with no networking write to a bind mounted path, then an external otel-cli picks them up and sends along.

spool=$(mktemp -d)

# write incoming spans to the /tmp/$spool directory
otel-cli server spool --directory /tmp/$spool --protocol http/protobuf --endpoint localhost:4318

# or, use otel-cli as usual but point endpoint to disk? this would be nice for debugging...
otel-cli exec --endpoint file://$spool -- sleep 1

# read all the spans in this directory and send them upstream
otel-cli server replay --directory /tmp/$spool --endpoint https://my-collector:9999

Seems like plain flock() should be sufficient for locking. I think I would only support protobuf to avoid type erasure. I started looking at how much work it is, and it's not too bad, and not super invasive. I did the first bits to expose the raw protobuf spans and events through CliEvent here: https://github.com/equinix-labs/otel-cli/tree/spool-spans-to-disk

@garthk did I understand your use case correctly?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Begin by reading issue #183 and the spool-spans-to-disk branch, especially the existing CliEvent exposure for raw protobuf spans and events. Validate the design against the documented spool and replay command examples, including directory locking and protobuf-only behavior; done means spans can be written offline and later replayed to the collector.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
cli, observability
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.