NewRelic Integration With Spring Boot Using io.micrometer

589 views Asked by At

I have installed the NewRelic agent on MacOS and configured the spring boot application by following docs and few other links. Also tried telemetry micrometer configuration. Thing I want to achieve is to integrate spring boot application without installing java agent and register under APM. Below is my configuration:

management:  
    metrics:
        export:
            newrelic:
            api-key: <Tried all the keys> ()
            account-id: 
            enabled: true
            step: 30s
        <dependency>
            <groupId>io.micrometer</groupId>
            <artifactId>micrometer-registry-new-relic</artifactId>
            <version>1.9.5</version>
        </dependency>

Error:

ERROR [new-relic-metrics-publisher] io.micrometer.newrelic.NewRelicInsightsApiClientProvider: failed to send metrics to new relic: http 403 {}

I tried to debug the provider NewRelicInsightsApiClientProvider to check what is being passed as Stream of events, everything looks good to me. The insightsEndpoint is "https://insights-collector.newrelic.com/v1/accounts/ACCOUNT-ID/events" I even tried to change with "https://insights-collector.eu01.nr-data.net" did not help.

Need some help here, not sure what am I missing.

2

There are 2 answers

0
Govil Kumar On BEST ANSWER

The configuration which worked for me

  metrics:
    export:
      newrelic:
        api-key: #insights key 
        account-id: #<account-id>
        enabled: true
        step: 30s #duration at which events will be published to new relic
        #uri: https://insights-collector.eu01.nr-data.net #URI of the data center
        uri: https://metric-api.eu.newrelic.com
        serviceName: <service name>

As mentioned by @André Onuki generate your insights key from right side of the new relic's API keys page, More Details. NewRelicInsightsApiClientProvider uses a default URI which did not work for me, so I looked up for the Data Center URI. To identify the data center, check your license key if it starts with "eu" then it's European. Start your application, check under APM & Services section of NewRelic.

5
André Onuki On

I believe the key you should use there is an Insights insert key. This key is located in a different location from other keys.

If you go to the page where you have your regular keys, you'll find a link to the Insights keys. insights key location

Alternatively, you could also use New Relic's Micrometer registry. This is a different implementation of the registry created by New Relic.