Can I view a trace from a query?

I queried the APM traces using:

SELECT count(*) FROM Transaction FACET `request.headers.host` WHERE `request.headers.host` = 'www.staging.example.com' SINCE 30 MINUTES AGO TIMESERIES

This shows a statistic about recent traces.

I want to open a specific trace now, so I modified the query to

SELECT * FROM Transaction FACET `request.headers.host` WHERE `request.headers.host` = 'www.staging.example.com' SINCE 30 MINUTES AGO TIMESERIES

this cannot be rendered.

How can I query APM data for a specific request-host and narrow down the transaction to see the details in a second step?

Hi, @a.menk: Try removing FACET and TIMESERIES from your second query:

SELECT * FROM Transaction WHERE `request.headers.host` = 'www.staging.example.com' SINCE 30 MINUTES AGO

Thanks @philweber, that gives me a data table of the transactions, so far so good.

But if I view transactions using the data explorer I can click the transaction and see all the PHP function calls and other details.

How can I jump from that query-result-table I have now, to the transaction explorer?

I don’t think it is possible to do that.

This post was flagged by the community and is temporarily hidden.

Sad … is there another way to filter the traces by request.host?

You may use the Instances dropdown in the upper-right corner to select an individual host:

I tried that, but there is only one domain listed.
On the server we have one apache webserver + PHP-FPM with several vhosts, these vhosts seem to be not detected as different instances.
Not sure if we have to change the whole server setup (would be unfortunate) or if there is a way to filter by any of the rich data which is pushed into NewRelic.

You should be able to edit the newrelic.process_host.display_name configuration setting to have each vhost appear as a separate instance. You may need to configure per-directory .INI settings.

Another option is to give your application multiple names. So you can have a single name that aggregates data from all your vhosts, and a separate app name for each host.

Thanks for the workarounds.

Anyways, in this case it also will not work fully - at least without lots of changes to the server, because we also have multiple host names (ServerAlias) on the same VHost …

My question goes more into the direction how to query the Agent attributes from the trace, which are already present in the trace details when opened via the UI.

It’s a pitty there is no more powerful filtering here :frowning: Maybe that can be taken as a feature request?