Say I have some code like this:
require OpenTelemetry.Span
require OpenTelemetry.Tracer
def hello do
OpenTelemetry.Tracer.with_span "hello method" do
val = :world
OpenTelemetry.Span.set_attributes(result: val)
val
end
end
I’d like to be able to test:
- that a span with the name “hello method” was created
- that it had the attribute
result: :world - what the parent id was, if any
- whether it was recorded
- whether it was sampled
With Telemetry you can :telemetry.attach and give it a fake handler. Not sure what the best approach is for OpenTelemetry. Anyone have ideas?






















