How to Group some Metrics but not others in Dashboards

Hello experts,
My team are trying to reach a solution to the following need that’s comprised of two parts:

  1. We are looking for a way to group a subset of External/ metrics for the purposes of having them shown as a single data source in dashboards.

For example, we have metrics
and we wish to create a dashboard showing the average duration of calls to service-1 and service-2 separately, but group service-3a and service-3b under ‘service-3’.

  1. We also wish to have a programmatical way to select which services should be grouped, as the list would be large and variable dependent on deployments and also through time. Having to update queries manually is not a sustainable option.

An idea was to leverage custom attributes for this. I.e. identify places in code where the external hosts being called should be grouped, and then use
NewRelic.Api.Agent.NewRelic.GetAgent().CurrentTransaction.AddCustomAttribute({my_service-3_tag}, {external_host})
to ‘mark’ those respective hosts for grouping.

I have been playing around with NRQL queries to try to produce a dashboard based on the data from both Metric and Transaction that would have
on its X axis, and average(newrelic.timeslice.value) on Y. However, I am not very successful at getting the custom attributes data to be used properly. Hoping for some help on that / guidance if there are other ways or this is just not possible at this time.

Its possible to combine some of these, but is the goal is to do it easily then it may be best to find a solution that doesn’t involve carefully forming the NRQL.

You may want to consider an event for the external calls as an option. That would probably give you the greatest flexibility and control. In other words wrapping the external calls within the transaction as a new event and recording that in parallel to the transaction. You would need to manage collecting the information you wanted to retain like endpoint, duration, response codes, timeouts etc etc and post that with your event.

You can use WITH_FORMAT and maybe RLIKE along with FILTER() and CASES() to try to group things up in NRQL, but if you want to do this kind of thing at a large scale with a diverse pool of endpoints I think you have arrived at that being unreasonable. I’d agree.

1 Like

Thanks for the great explanation as always @6MM! Let us know how that works out for you @sofiya.zlateva!