Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add LoggerProvider support to @effect/opentelemetry #4371

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jpowersdev
Copy link

Type

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Add LoggerProvider and LogRecordProcessor support to @effect/opentelemetry, as well as a logger layer (using Logger.addEffect to run alongside existing loggers) that will emit logs using the registered LogRecordProcessor.

Copy link

changeset-bot bot commented Jan 31, 2025

🦋 Changeset detected

Latest commit: 67ebeef

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@effect/opentelemetry Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jpowersdev
Copy link
Author

Working on tests and docs before removing draft status

@jpowersdev jpowersdev changed the title Add otel logger provider support Add LoggerProvider support to @effect/opentelemetry Jan 31, 2025
@jpowersdev
Copy link
Author

I tried to follow the existing structure as best I could, but please let me know if anything needs to be modified.

@jpowersdev jpowersdev marked this pull request as ready for review January 31, 2025 03:13
@jpowersdev jpowersdev requested a review from tim-smart as a code owner January 31, 2025 03:13
)

/** @internal */
const formatMessage = Match.type<unknown>().pipe(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think instead we can reuse this

https://github.com/Effect-TS/effect/blob/main/packages%2Fopentelemetry%2Fsrc%2Finternal%2Ftracer.ts#L310

Using the Match module is a bit too much here.

There are probably other functions that could be moved to a utils module

severityText: structured.logLevel,
severityNumber: options.logLevel.ordinal,
timestamp: options.date,
observedTimestamp: new Date(),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use the clock service instead.

* @since 1.0.0
* @category layers
*/
export const layerLoggerProvider = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a direct export instead of a wrapper function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Waiting on Author
Development

Successfully merging this pull request may close these issues.

2 participants