Search code examples
javaspring-bootnewrelicspring-micrometerspring-actuator

NewRelic Integration With Spring Boot Using io.micrometer


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.


Solution

  • 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.