opentelemetry-js icon indicating copy to clipboard operation
opentelemetry-js copied to clipboard

[api-logs] ensure all "private" properties/methods/functions are marked as "conventially private"

Open pichlermarc opened this issue 5 months ago • 0 comments
trafficstars

Description

Many of our types make use of private fields/methods, or implement methods that are public, but actually only intended for "package private" use. It frequently happens that end-users access these regardless since they're not marked as "conventionally private" (starting with an underscore _). We should ensure that any properties that fit the above criteria are marked as "conventionally private" too.

We should do this even in places where the actual type is not exported from the package, since the object itself may still be accessible to the end-users (an example for this would be ProxyLoggerProvider if made internal by #5733)

This issue is considered done when

  • all instances of this have been addressed in the @opentelemetry/api-logs package

Addtional context

Examples (non-exhaustive list):

  • ProxyLoggerProvider#getDelegate() is implicitly public but is actually intended to be package-private
    • https://github.com/open-telemetry/opentelemetry-js/blob/22bc5bac9bf1ab6300f826576c6f3f748522e157/experimental/packages/api-logs/src/ProxyLoggerProvider.ts#L37
  • ProxyLoggerProvider#setDelegate() is implicitly public but is actually intended to be package-private
    • https://github.com/open-telemetry/opentelemetry-js/blob/22bc5bac9bf1ab6300f826576c6f3f748522e157/experimental/packages/api-logs/src/ProxyLoggerProvider.ts#L44-L46
  • ProxyLoggerProvider#getDelegateLogger() is implicitly public but is actually intended to be package-private
    • https://github.com/open-telemetry/opentelemetry-js/blob/22bc5bac9bf1ab6300f826576c6f3f748522e157/experimental/packages/api-logs/src/ProxyLoggerProvider.ts#L48-L54
  • These properties seem to be intended to be package-private:
  • https://github.com/open-telemetry/opentelemetry-js/blob/22bc5bac9bf1ab6300f826576c6f3f748522e157/experimental/packages/api-logs/src/ProxyLogger.ts#L28-L30

pichlermarc avatar Jun 02 '25 09:06 pichlermarc