You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe
I'm using the OpenTelemetry Node SDK to initialize OpenTelemetry because it does most of the work of setting it up. Besides the default span processor, I want to add some more span processors. I was using addSpanProcessor but it was deprecated here: open-telemetry/opentelemetry-js#5134
At first, spanProcessors constructor option of NodeSDK seems designed for this use-case, but it has a shortcoming: you must specify the extra ones plus the default BatchSpanProcessor. However, the BatchSpanProcessor requires an instance of exporter, that it's created automatically for us via environment variables. Currently, it's not feasible to create an exporter based on environment variables without duplicating code, since the code that does it is hidden via private functions, e.g.: _buildExporterFromEnv and _getSpanExporter within BasicTracerProvider class.
Describe the solution you'd like to see
I would like an easy way to add span processors without having to duplicate the initialization of BatchSpanProcessor and the initialization of the exporter based on environment variables.
Approach 1:
Allow spanProcessors to be a function in order to append / prepend processors:
Is your feature request related to a problem? Please describe
I'm using the OpenTelemetry Node SDK to initialize OpenTelemetry because it does most of the work of setting it up. Besides the default span processor, I want to add some more span processors. I was using
addSpanProcessor
but it was deprecated here: open-telemetry/opentelemetry-js#5134At first,
spanProcessors
constructor option ofNodeSDK
seems designed for this use-case, but it has a shortcoming: you must specify the extra ones plus the defaultBatchSpanProcessor
. However, theBatchSpanProcessor
requires an instance of exporter, that it's created automatically for us via environment variables. Currently, it's not feasible to create an exporter based on environment variables without duplicating code, since the code that does it is hidden via private functions, e.g.:_buildExporterFromEnv
and_getSpanExporter
withinBasicTracerProvider
class.Describe the solution you'd like to see
I would like an easy way to add span processors without having to duplicate the initialization of
BatchSpanProcessor
and the initialization of the exporter based on environment variables.Approach 1:
Allow
spanProcessors
to be a function in order to append / prepend processors:The same logic could be applied to
logRecordProcessors
.Approach 2:
Export the necessary functionality to create stuff from env, such as exposing
_buildExporterFromEnv
,_buildPropagatorFromEnv
, etc.Describe alternatives you've considered
addSpanProcessor
for now.BatchSpanProcessor
The text was updated successfully, but these errors were encountered: