Skip to content

Conversation

trentm
Copy link
Contributor

@trentm trentm commented Jul 14, 2025

This will fix the CI failure in #1897. @opentelemetry/sdk-logs@0.203.0
dropped the deprecated LoggerProvider#addLogRecordProcessor(...)
method.

Refs: open-telemetry/opentelemetry-js#5764


Note that the (undocumented?) configureLoggerProvider global might not be as useful anymore. A user specifying that global function will no longer be able to add a LogRecordProcessor to the given LoggerProvider instance. I'm not sure if configureLoggerProvider is considered a promised interface.

Unrelated to this PR, it might make sense to change configureLoggerProvider to be more like configureTracer. The latter is given a config object to customize that is later given to new NodeTracerProvider(config);. This would be a more future-proof API.

…'processors' constructor arg

This will fix the CI failure in open-telemetry#1897. `@opentelemetry/sdk-logs@0.203.0`
*dropped* the deprecated `LoggerProvider#addLogRecordProcessor(...)`
method.

Refs: open-telemetry/opentelemetry-js#5764
@trentm
Copy link
Contributor Author

trentm commented Jul 14, 2025

The latter is given a config object to customize that is later given to new NodeTracerProvider(config);. This would be a more future-proof API.

Actually I was just reading about the OTel Spec's "development" status *Configurator things:

These will eventually likely be the appropriate mechanism for configuring the SDK. However, they are limited to enabled/disable state currently. I'm not sure exactly what a best future-proof API for the lambda layer would be here. Anyway, this is a bit off-topic for this immediate fix.

@serkan-ozal
Copy link
Contributor

Hi @trentm,

Thanks for taking care of this fix.

Yep, I have been thinking of introducing configureLogger function to allow users customizing logger config instead of configuring over configureLoggerProvider.

And, we can still keep the configureLoggerProvider until major release (v1), but it will not be useful for the users other than setting LoggerProvider to global (logs.setGlobalLoggerProvider). To be backward compatible for configureLoggerProvider.addLogRecordProcessor over global configureLoggerProvider function, we might have some tricks, but I don't think it worths to introduce such complexity.

So, I think, what we can do is that:

  • Introduce configureLogger function (similar to configureTracer)
  • And mention in the release notes that configureLoggerProvider.addLogRecordProcessor over global configureLoggerProvider function is no longer supported. Use configureLogger function instead.

cc @tylerbenson @wpessers @pragmaticivan

@wpessers
Copy link
Contributor

Solution offered by @serkan-ozal sounds good to me. In the past when we dropped support for configureTracerProvider we allowed for a "grace period" by marking it deprecated first before removing it in the subsequent release. But I believe, as these global functions aren't really documented they probably aren't widely used. So in my opinion, including in release notes is sufficient.

@serkan-ozal
Copy link
Contributor

Created a follow-up ticket to introduce configureLogger function #1905 and so merging this PR as is.

@serkan-ozal serkan-ozal merged commit 3106109 into open-telemetry:main Jul 17, 2025
12 checks passed
@trentm trentm deleted the trentm-nodejs-stop-using-addLogRecordProcessor branch July 17, 2025 15:13
@tylerbenson tylerbenson added the javascript Pull requests that update Javascript code label Aug 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
javascript Pull requests that update Javascript code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants