查询.sql 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. select distinct AppAlias, count() as cnt
  2. from otel.otel_traces
  3. where Timestamp> now() - interval 1 hour
  4. group by AppAlias
  5. order by cnt desc;
  6. select distinct TraceId, any(Timestamp)
  7. from otel.otel_traces_url
  8. where Timestamp > now() - interval 1 hour
  9. and Timestamp < now()
  10. and AppAlias = 'WLGLPT'
  11. and Route is not null
  12. and Route != ''
  13. group by TraceId;
  14. select AppAlias, count() as cnt
  15. from otel.otel_traces
  16. where Timestamp
  17. > now() - interval 1 hour
  18. group by AppAlias
  19. order by cnt desc;
  20. 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(
  21. (SpanAttributes['url.path']) != '', SpanAttributes['url.path'], (SpanAttributes['http.target']) != '',
  22. path(SpanAttributes['http.target']), (SpanAttributes['http.url']) != '', path(SpanAttributes['http.url']),
  23. (SpanAttributes['u\nrl.full']) != '', path(SpanAttributes['url.full']),
  24. SpanAttributes['http.route']) AS path
  25. SELECT if(route != '', route, replaceRegexpOne(path, varPattern, '{:var}')) AS Route,
  26. TraceId,
  27. ServiceName,
  28. SpanId,
  29. ParentSpanId,
  30. Duration,
  31. StatusCode,
  32. AppAlias
  33. from otel.otel_traces
  34. where Timestamp > now() - interval 1 day
  35. and Timestamp < now()
  36. and TraceId = '31ea480e0060438c80aefd4f98371de4';