Otel TracerProvider Embedding hard to auto-mock.
Author: rbtcollinsCreated Nov 25, 2025Updated Dec 16, 2025
Labelsduplicate
Description
There is a marker interface 'embedded.TracerProvider' with unexported methods https://pkg.go.dev/go.opentelemetry.io/otel/trace/embedded#TracerProvider
With a testify style mock, the Mock does not implement otel.trace.TracerProvider unless the generated code is edited to add that same embedded interface.
Perhaps there is another way of doing it; I'm not sure, but I thought you'd like to know :>
Having some way to add some code to the generated mock struct definition would perhaps be enough to solve this.
Source: vektra/mockery