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

Enhanced support for NewRelic APM #1761

Closed
schmidt-galen-heb opened this issue Dec 19, 2019 · 5 comments
Closed

Enhanced support for NewRelic APM #1761

schmidt-galen-heb opened this issue Dec 19, 2019 · 5 comments
Labels
duplicate A duplicate of another issue registry: new relic A New Relic Registry related issue

Comments

@schmidt-galen-heb
Copy link
Contributor

Howdy! I'm using NewRelic APM to monitor my Springboot applications, and am investigating reporting custom MicroMeter metrics to NewRelic Insights.

This was previously implemented in feature request #122.
Two potential integration paths were investigated:

  1. Indirect integration via the NewRelic Java Agent
  2. Direct integration via the Insights REST API

Ultimately, option (2) was chosen because:

  1. Integration via the agent required the use of APM custom metrics, which are less powerful than Insights metrics
  2. The agent must be installed as a Java agent on the application JVM, which requires customizing the JVM startup arguments as well as providing an agent configuration file

In my case however, we've already integrated the APM agent, and option (1) requires use of an Insights API key, as well as specifying the NewRelic account ID, neither of which are required by the agent (and thus we aren't currently providing them).

The agent API allows programmatic access to the Insights API via NewRelic.getAgent().getInsights(), and metrics can then be recorded via the Insights.recordCustomEvent(...) method. NewRelic's guide on this is here.

Note: the current implementation also records metrics as a custom event internally, but does so using the insights API directly.

In addition to the existing NewRelicMeterRegistry, I'd like to have the option of using a class (called something like NewRelicApmMeterRegistry) which utilized the APM agent's Java API to submit metrics. Since submitting custom events via the agent does not appear to require any additional configuration, this is a much simpler integration path for consumers who are already utilizing the NewRelic APM.

(additional note: I've looked briefly at newrelic/micrometer-registry-newrelic, but it also appears to require an insights API key, which is what I'm trying to avoid for applications already integrated with the APM).

@schmidt-galen-heb
Copy link
Contributor Author

If you think this feature request makes sense, I'd be potentially interested in submitting a PR to implement it.

First though, do you have a contributor license agreement for the project? I wasn't able to find one looking over the repo/website

@schmidt-galen-heb
Copy link
Contributor Author

I've submitted a PR for this here: #1854

After more investigation into the existing code, as well as how Spring integrates with it, I decided that although pulling the APM integration into a separate MeterRegistry subclass makes more sense from a design perspective, it would make it significantly more difficult for clients to integrate.

@shakuzen shakuzen added the registry: new relic A New Relic Registry related issue label Mar 12, 2020
@shakuzen
Copy link
Member

First of all, thank you for the detailed description and a very complete pull request. I apologize I didn't respond to this much sooner. We had #1540 already open which I believe is the same as your request. The good news is we just merged an implementation for it with #1647 which will be part of the upcoming 1.4 release. Sorry I didn't share this before you went to the trouble of making a pull request.

Would you be willing to take a look at that issue and pull request to make sure it covers what you're expecting and works for you? I like that in your pull request, you've made it configurable in NewRelicConfig which implementation gets used. It would be appreciated if you could rework your pull request or open a new one to make that possible with the latest changes.

/cc @neiljpowell

@neiljpowell
Copy link
Contributor

neiljpowell commented Mar 12, 2020

Hi. I created #1647 for the very same reason. APM Agent users get the benefit of publishing metrics to the same Insights MicrometerSample event type but without needing to manage distribution of the API Key and Account Id. The Agent also automatically adds the appName as an attribute to metrics published.

I'll be opening a PR with Spring Boot to enable the Agent delegation feature (publishes to a SpringBootSample event type), once Micrometer 1.4 is released.

@shakuzen
Copy link
Member

Duplicate of #1540

@shakuzen shakuzen marked this as a duplicate of #1540 Apr 23, 2020
@shakuzen shakuzen added the duplicate A duplicate of another issue label Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate A duplicate of another issue registry: new relic A New Relic Registry related issue
Projects
None yet
Development

No branches or pull requests

3 participants