Reputation: 612
We are running Elasticsearch with the NewRelic Java agent installed. We want to record custom metrics without changing anything in ES.
I know the NewRelic proposed way to do this is Steven Eksteens Elasticsearch Plugin but it's Ruby based and we try to avoid adding another language to our stack. I tried to replicate Stevens efforts in Python, using the NewRelic Python agent and the newrelic.agent.record_custom_metric function:
import newrelic.agent
from time import sleep
import logging
logger = logging.getLogger()
logging.basicConfig(format='%(levelname)s:%(message)s', level=logging.DEBUG)
# generate config file with 'newrelic-admin generate-config <apicode> newrelic.ini'
newrelic.agent.initialize('newrelic.ini')
application_str = dict(newrelic.agent.newrelic.core.config.global_settings())["app_name"]
application = newrelic.agent.register_application(application_str)
while True:
newrelic.agent.record_custom_metric('Custom/Value', 1, application)
sleep(10)
This works fine. Only problem: If configured to use the same app_name as the existing java-agent controlled App it registers a new app in NewRelic with the appendix '(Python)'. What I want is to add the metrics to the original one. Is this possible?
Upvotes: 0
Views: 575
Reputation: 292
Applications in the New Relic Dashboard have to be the same language to be consolidated. Otherwise you will end up with multiple applications with the same name and an appended language name due to the type of metrics and manner of reporting in different languages.
There is no way to consolidate two applications of the same name written in different languages in your New Relic account. You could however create a custom dashboard which will allow you to place charts from multiple applications in one dashboard.
Upvotes: 1