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

nrzerologplugin: Plugin to support logs in context for Zerolog #294

Closed
wants to merge 1 commit into from

Conversation

belimawr
Copy link

@belimawr belimawr commented Apr 14, 2021

Links

solves #178

Details

This adds a integration to enable logs-in-context for zerolog,
this integrarion is split into two parts:

  • HTTP middleware: adds the "LinkingMetadata" into the logger's
    context.
  • Zerolog Hook: Adds the caller's information to the logs.

This PR still in a draft stage, but I wanted to share my approach and get some early feedback.
I'm aware the example still needs improvement, like adding all NewRelic initialisation, and documentation needs to be written.

It has already tested it with a demo application and it worked pretty well.

Open questions:

  1. How is the file name, line and function names used by NewRelic? Are they required?

Caveats:

  • We cannot get the timestamp from zerolog, so we use time.Now.
  • Reading the filename and line depend on some internals of zerolog.

This commit adds a integration to enable logs-in-context for zerolog,
this integrarion is split into two parts:
* HTTP middleware: adds the "LinkingMetadata" into the logger's
context.
* Zerolog Hook: Adds the caller's information to the logs.

Caveats:
* We cannot get the timestamp from zerolog, so we use time.Now.
* Reading the filename and line depend on some internals of zerolog.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@RichVanderwal
Copy link
Contributor

Thanks for the PR, @belimawr ! We'll be taking a look at it and comparing it to our current strategy for doing Logs in Context.

@RichVanderwal RichVanderwal linked an issue Apr 27, 2021 that may be closed by this pull request
@RichVanderwal
Copy link
Contributor

Considering this for inclusion in the next release of the Go Agent, with added information from this ticket.

@victoraugustolls
Copy link

Hey @RichVanderwal , hope you are doing well! I was looking for zerolog support and found this issue and was wondering if you guys are still taking a look at this! Looking forward to it, thanks in advance.

@rwong2888
Copy link

rwong2888 commented Dec 1, 2021

Any traction on this getting merged? I'd like to see zerolog support

@RichVanderwal
Copy link
Contributor

While I can't commit to dates, this feature is on our team's roadmap for consideration and implementation.

@iamemilio
Copy link
Contributor

iamemilio commented Sep 21, 2022

Hi, please take a look at v3/integrations/logcontext-v2/zerologWriter! This should meet your needs, and if it doesn't let us know!

@iamemilio iamemilio closed this Nov 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Zerolog Logs in Context
6 participants