hyperdx icon indicating copy to clipboard operation
hyperdx copied to clipboard

Preset Service dashboard error rate chart uses old/deprecated opentelemetry semantic convention

Open bcarlock-mycarrier opened this issue 8 months ago • 0 comments

As the title states, the service dashboard error rate chart is using http.scheme as a filter, however newer implementations of OpenTelemetry will use url.scheme.

This is the query used in v2.0.0-beta.13:

SELECT countIf(lower(StatusCode) = 'error') / count() AS "Error Rate %",
  SpanName,
  toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
FROM { HYPERDX_PARAM_1381785600 :Identifier }.{ HYPERDX_PARAM_1458476743 :Identifier }
WHERE (
    Timestamp >= fromUnixTimestamp64Milli({ HYPERDX_PARAM_1581248397 :Int64 })
    AND Timestamp <= fromUnixTimestamp64Milli({ HYPERDX_PARAM_721779221 :Int64 })
  )
  AND (
    (SpanAttributes ['http.scheme'] = 'http')
    AND (SpanKind IN ('Server', 'SPAN_KIND_SERVER'))
  )
GROUP BY SpanName,
  toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
ORDER BY toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
LIMIT { HYPERDX_PARAM_1448635039 :Int32 }

Here is the current OpenTelemetry semantic convention: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/non-normative/http-migration.md#http-server-span-attributes

Image

In order to provide backwards compatibility as well as support current/future versions I would propose we change the query to this:

SELECT countIf(lower(StatusCode) = 'error') / count() AS "Error Rate %",
  SpanName,
  toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
FROM { HYPERDX_PARAM_1381785600 :Identifier }.{ HYPERDX_PARAM_1458476743 :Identifier }
WHERE (
    Timestamp >= fromUnixTimestamp64Milli({ HYPERDX_PARAM_1581248397 :Int64 })
    AND Timestamp <= fromUnixTimestamp64Milli({ HYPERDX_PARAM_721779221 :Int64 })
  )
  AND (
    (SpanAttributes ['http.scheme'] = 'http' OR SpanAttributes ['http.url'] = 'http')
    AND (SpanKind IN ('Server', 'SPAN_KIND_SERVER'))
  )
GROUP BY SpanName,
  toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
ORDER BY toStartOfInterval(toDateTime(Timestamp), INTERVAL 1 minute) AS `__hdx_time_bucket`
LIMIT { HYPERDX_PARAM_1448635039 :Int32 }

bcarlock-mycarrier avatar Apr 25 '25 19:04 bcarlock-mycarrier