opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

Add open telemetry severity hook integration for zerolog

Open AkhigbeEromo opened this issue 1 year ago • 3 comments

This PR introduces the otelzerolog package, which provides a SeverityHook to bridge the logging capabilities of Zerolog with OpenTelemetry. The following key features are included:

Changes

  • Added config struct to handle configuration options.
  • Implemented Option interface and related functions (WithVersion, WithSchemaURL, WithLoggerProvider).
  • Created NewSeverityHook function to initialize a SeverityHook.
  • Defined SeverityHook struct to perform the logging bridge functionality.

Part of https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5405

AkhigbeEromo avatar Jun 18 '24 22:06 AkhigbeEromo

Hello @MrAlias, hope this is okay for a start

AkhigbeEromo avatar Jun 18 '24 22:06 AkhigbeEromo

Also, do i need to make a changelog for each of the PRs concerning the zerolog bridge

AkhigbeEromo avatar Jun 18 '24 22:06 AkhigbeEromo

Thank you @dmathieu, I know what to do now.

I will split up and send in another PR

AkhigbeEromo avatar Jun 24 '24 08:06 AkhigbeEromo

You will need to add this module to the versions.yaml file, in the excluded-modules section. https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/versions.yaml#L91

dmathieu avatar Jul 08 '24 12:07 dmathieu

Codecov Report

Attention: Patch coverage is 97.14286% with 1 line in your changes missing coverage. Please review.

Project coverage is 64.7%. Comparing base (e2d29ee) to head (ecd5abf).

Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #5782   +/-   ##
=====================================
  Coverage   64.6%   64.7%           
=====================================
  Files        201     202    +1     
  Lines      12594   12629   +35     
=====================================
+ Hits        8143    8175   +32     
- Misses      4215    4217    +2     
- Partials     236     237    +1     
Files Coverage Δ
bridges/otelzerolog/hook.go 97.1% <97.1%> (ø)

... and 1 file with indirect coverage changes

codecov[bot] avatar Jul 08 '24 12:07 codecov[bot]

I have done it @dmathieu Is there any other changes you will like me to add?

AkhigbeEromo avatar Jul 08 '24 21:07 AkhigbeEromo

There are still lint issues that need fixing.

dmathieu avatar Jul 09 '24 07:07 dmathieu

What about CODEOWNERS? Who will maintain the new bridge?

More: https://github.com/open-telemetry/opentelemetry-go-contrib/blob/main/CONTRIBUTING.md#code-owners

pellared avatar Jul 11 '24 11:07 pellared

Why was this merged as an unfinished implementation? I had the misfortune of coming across this today and attempting to wire it up. Wasted a significant portion of my day until I got so frustrated that I vendored my dependencies and started poking at the underlying libraries, realizing that Run is just a TODO comment.

iancharters avatar Jul 15 '24 06:07 iancharters

@iancharters, the module is not released. It is your own responsibility to use pseudo versions of in-development modules.

pellared avatar Jul 15 '24 06:07 pellared