hyperledger-labs / fabric-smart-client

The Fabric Smart Client is a new Fabric Client that lets you focus on the business processes and simplifies the development of Fabric-based distributed application.
Apache License 2.0
51 stars 52 forks source link

Allow existing trace provider in OpenTelemetry integration #600

Closed PERSEJOZA closed 3 months ago

PERSEJOZA commented 5 months ago

The library has a support for OpenTelemetry by providing some configuration parameters. However, we noticed that the trace provider defined in the library overwrites the trace provider defined in the microservice, resulting in inconsistent spans with different microservice names. Moreover, if there are multiple exporters defined, span information is shared via several channels, which is inefficient and eliminates the benefits of a configurable exporter.

It would be nice if the library could provide a way to keep an existing trace provider if it is already defined or just let the microservice that uses it to configure tracing. This would allow for more flexibility and better integration with other tracing solutions.

arner commented 3 months ago

Fabric Smart Client already provides this option, see https://github.com/hyperledger-labs/fabric-smart-client/blob/main/docs/monitoring.md. If you use Token SDK, you could not override it anymore because the sdk already did that (and dig does not allow the same dependency to be overridden twice). It will be fixed with https://github.com/hyperledger-labs/fabric-token-sdk/pull/725.