Unable to return error rate against URI from APM Transaction

  1. Following on from this thread, I discovered I cannot return error rate from APM Transaction.

    FROM Transaction SELECT filter(count(*), WHERE error IS true)
    

    The above query returns 0, despite there being 120 results from FROM TransactionError SELECT count(*). Why the discrepancy?

  2. As a workaround, I’ve been using the following to return the error rate.

    FROM Metric
      SELECT count(apm.service.error.count) / count(apm.service.transaction.duration) * 100
      WHERE appName LIKE '%'
    

    What do you think about this? Can it be formatted better?

  3. I know that Transaction has request_uri which allows you to break out by URIs. Is there an equivalent for Metric?

Thanks for your time.

Hi, @rishav.dhar: Which APM language agent are you using? It is possible the agent you are using does not set the error attribute to true when an error occurs.

1 Like

It’s the .NET agent I’m using. Do you happen to have any thoughts about 2 and 3?

No thoughts on 2 or 3. I have not worked much with metric queries.

For some closure, FROM Transaction SELECT count(errorType) returns the count of errors, just as I’d been after. Here’s the complete query:

FROM Transaction
  SELECT count(errorType)/count(duration)
  WHERE appName LIKE '%'
  SINCE today at '06:00'
  FACET response.status,
        errorMessage,
        name
  LIMIT MAX

This outputs a table of: response code, error message, transaction name, and count. I would’ve preferred transactionUiName (from TransactionError) instead of name for better legibility. However, using Transaction across the board allows us to filter by facets, which is well-handy.


Alternatively, here’s a variant using TransactionError instead to help tabulate the list of errors.

FROM TransactionError
  SELECT count(*)
  WHERE appName LIKE '%Tier%'
  SINCE today at '06:00'
  FACET response.status,
        error.message,
        transactionUiName
  LIMIT MAX

Hi, @rishav.dhar: Just curious: In your first query, why count(duration) rather than count(*)? Also, you don’t need WHERE appName LIKE '%'; you can just omit the WHERE clause.

1 Like

You’re absolutely right, count(*) works just as well as count(duration) while WHERE appName LIKE '%' is mostly just a relic from dealing with Metric queries.

1 Like