[GH-ISSUE #1218] Each transaction is market as an error on New Relic #507

Closed
opened 2026-03-04 02:15:34 +03:00 by kerem · 8 comments
Owner

Originally created by @kolesar on GitHub (Nov 6, 2018).
Original GitHub issue: https://github.com/Seldaek/monolog/issues/1218

I do not know what is the initial idea when this code is written, but with this else condition here each transaction will be marked as an error.

github.com/Seldaek/monolog@6bb347c040/src/Monolog/Handler/NewRelicHandler.php (L94)

Originally created by @kolesar on GitHub (Nov 6, 2018). Original GitHub issue: https://github.com/Seldaek/monolog/issues/1218 I do not know what is the initial idea when this code is written, but with this `else` condition here each transaction will be marked as an error. https://github.com/Seldaek/monolog/blob/6bb347c040bb29f42c2c249714aac8c0e36c2454/src/Monolog/Handler/NewRelicHandler.php#L94
kerem closed this issue 2026-03-04 02:15:34 +03:00
Author
Owner

@Seldaek commented on GitHub (Nov 19, 2018):

IMO monolog's newrelic handler is really mostly made for tracking errors.. I don't really see how we could treat non-errors nicely with the newrelic API. That's maybe better done at the application level? Or do you have a suggestion how this could be improved?

<!-- gh-comment-id:440080048 --> @Seldaek commented on GitHub (Nov 19, 2018): IMO monolog's newrelic handler is really mostly made for tracking errors.. I don't really see how we could treat non-errors nicely with the newrelic API. That's maybe better done at the application level? Or do you have a suggestion how this could be improved?
Author
Owner

@kolesar commented on GitHub (Nov 20, 2018):

To be honest I do not have experience with New Relic too. My suggestion is only what I found during implementation it in my project, but probably it is the absolutely wrong way. As you say, maybe a different way of thinking and implementation is the solution.

<!-- gh-comment-id:440156755 --> @kolesar commented on GitHub (Nov 20, 2018): To be honest I do not have experience with New Relic too. My suggestion is only what I found during implementation it in my project, but probably it is the absolutely wrong way. As you say, maybe a different way of thinking and implementation is the solution.
Author
Owner

@jderusse commented on GitHub (Dec 10, 2018):

Looking at the comment https://github.com/Seldaek/monolog/pull/1217#issuecomment-436212898 I think there is a misunderstood of the usage of new NewRelicHandler (or more generally a misunderstood of NewRelic)

NewRelic is not made for tracking logs (like logmatic or Sentry, ...), it only contains API to trac errors and response time.

The purpose of this handler is to send application's dis-function logs to NewRelic. In order to NOT send debug, notice or informational logs, you shouldn't configure a log level too low (IMHO error is enougth)

        newrelic:
            type: newrelic
            level: error
<!-- gh-comment-id:445722531 --> @jderusse commented on GitHub (Dec 10, 2018): Looking at the comment https://github.com/Seldaek/monolog/pull/1217#issuecomment-436212898 I think there is a misunderstood of the usage of new `NewRelicHandler` (or more generally a misunderstood of NewRelic) NewRelic is not made for tracking logs (like logmatic or Sentry, ...), it only contains API to trac errors and response time. The purpose of this handler is to send application's dis-function logs to NewRelic. In order to NOT send debug, notice or informational logs, you shouldn't configure a log level too low (IMHO `error` is enougth) ``` newrelic: type: newrelic level: error ```
Author
Owner

@Seldaek commented on GitHub (Dec 11, 2018):

@jderusse I'd tend to agree there. Do you have any opinion on https://github.com/Seldaek/monolog/pull/1217#issuecomment-436189051 ? Is that the correct interpretation? Relating to https://github.com/Seldaek/monolog/blob/master/src/Monolog/ResettableInterface.php#L15

<!-- gh-comment-id:446093529 --> @Seldaek commented on GitHub (Dec 11, 2018): @jderusse I'd tend to agree there. Do you have any opinion on https://github.com/Seldaek/monolog/pull/1217#issuecomment-436189051 ? Is that the correct interpretation? Relating to https://github.com/Seldaek/monolog/blob/master/src/Monolog/ResettableInterface.php#L15
Author
Owner

@jderusse commented on GitHub (Dec 11, 2018):

@Seldaek I answered in the PR (see https://github.com/Seldaek/monolog/pull/1217#issuecomment-446104846).

TL;DR: this is not the responsibility of Monolog to start or end a NewRelic transaction

<!-- gh-comment-id:446105265 --> @jderusse commented on GitHub (Dec 11, 2018): @Seldaek I answered in the PR (see https://github.com/Seldaek/monolog/pull/1217#issuecomment-446104846). TL;DR: this is not the responsibility of Monolog to start or end a NewRelic transaction
Author
Owner

@jamesmehorter commented on GitHub (Apr 26, 2023):

NewRelic is not made for tracking logs

This is no longer true, NewRelic does now track logs. The NewRelic PHP Agent captures application errors—I would expect this logging package's "NewRelicHandler" to solely ship logs to NR.

That said, NR PHP Agent versions >= 10.1.0.313 will automatically ship logs using monolog

<!-- gh-comment-id:1523626012 --> @jamesmehorter commented on GitHub (Apr 26, 2023): > NewRelic is not made for tracking logs This is no longer true, NewRelic does now track logs. The NewRelic PHP Agent captures application errors—I would expect this logging package's "NewRelicHandler" to solely ship logs to NR. That said, NR PHP Agent versions `>= 10.1.0.313` will automatically ship logs using monolog * https://docs.newrelic.com/docs/release-notes/agent-release-notes/php-release-notes/php-agent-1010313/ * https://docs.newrelic.com/docs/logs/logs-context/configure-logs-context-php/
Author
Owner

@Seldaek commented on GitHub (Apr 28, 2023):

Ok so what I'm hearing is we maybe should just deprecate this handler? Or is there still value in the error collection?

<!-- gh-comment-id:1527413496 --> @Seldaek commented on GitHub (Apr 28, 2023): Ok so what I'm hearing is we maybe should just deprecate this handler? Or is there still value in the error collection?
Author
Owner

@jamesmehorter commented on GitHub (Aug 29, 2023):

It seems that New Relic's PHP Agent presently does not log meta data which has been appended to log entries—only the log message is sent (whereas the Java Agent does do this). Perhaps once that feature is available deprecation of this handler would be logical.

<!-- gh-comment-id:1697723191 --> @jamesmehorter commented on GitHub (Aug 29, 2023): It seems that New Relic's PHP Agent presently does not log meta data which has been appended to log entries—only the log message is sent (whereas the Java Agent does do this). Perhaps once that feature is available deprecation of this handler would be logical.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/monolog#507
No description provided.