Testing
When relying on OpenTelemetry for your Observability needs, it can be important to test that certain spans are created and attributes correctly set. For example, can you be sure that you attaching the right metadata to data that ultimately powers an SLO? This document covers an approach to that kind of validation.
Setup
Only the opentelemetry
and opentelemetry_api
libraries are required for testing in Elixir/Erlang:
Set your exporter
to :none
and the span processor to :otel_simple_processor
. This ensure that your tests don’t actually export data to a destination, and that spans can be analyzed after they are processed.
A modified version of the hello
function from the Getting Started guide will serve as our test case:
Testing
Feedback
Was this page helpful?
Thank you. Your feedback is appreciated!
Please let us know how we can improve this page. Your feedback is appreciated!