

select distinct AppAlias, count() as cnt
from otel.otel_traces
where Timestamp> now() - interval 1 hour
group by AppAlias
order by cnt desc;

select distinct TraceId, any(Timestamp)
from otel.otel_traces_url
where Timestamp > now() - interval 1 hour
  and Timestamp < now()
  and AppAlias = 'WLGLPT'
  and Route is not null
  and Route != ''
group by TraceId;

select AppAlias, count() as cnt
from otel.otel_traces
where Timestamp
          > now() - interval 1 hour
group by AppAlias
order by cnt desc;


WITH '\\b[a-fA-F0-9]{32,}\\b|\\b[a-fA-F0-9\\-]{36}\\b|\\b\\[1-9]\\d*\\b' AS varPattern, SpanAttributes['http.route'] AS route, multiIf(
        (SpanAttributes['url.path']) != '', SpanAttributes['url.path'], (SpanAttributes['http.target']) != '',
        path(SpanAttributes['http.target']), (SpanAttributes['http.url']) != '', path(SpanAttributes['http.url']),
        (SpanAttributes['u\nrl.full']) != '', path(SpanAttributes['url.full']),
        SpanAttributes['http.route']) AS path
SELECT if(route != '', route, replaceRegexpOne(path, varPattern, '{:var}')) AS Route,
       TraceId,
       ServiceName,
       SpanId,
       ParentSpanId,
       Duration,
       StatusCode,
       AppAlias
from otel.otel_traces
where Timestamp > now() - interval 1 day
  and Timestamp < now()
  and TraceId = '31ea480e0060438c80aefd4f98371de4';



