2_view_otel_traces.sql 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. drop view if exists otel.otel_traces on cluster default sync;
  2. create view if not exists otel.otel_traces on cluster default as
  3. select Timestamp,
  4. TraceId,
  5. SpanId,
  6. ParentSpanId,
  7. TraceState,
  8. SpanName,
  9. multiIf(SpanKind=1, 'SPAN_KIND_INTERNAL',
  10. SpanKind=2, 'SPAN_KIND_SERVER',
  11. SpanKind=3, 'SPAN_KIND_CLIENT',
  12. SpanKind=4, 'SPAN_KIND_PRODUCER',
  13. SpanKind=5, 'SPAN_KIND_CONSUMER',
  14. 'SPAN_KIND_UNSPECIFIED') as SpanKind,
  15. ServiceName,
  16. ResourceAttributes,
  17. SpanAttributes,
  18. ScopeName,
  19. ScopeVersion,
  20. Duration,
  21. multiIf(StatusCode=0, 'STATUS_CODE_UNSET',
  22. StatusCode=1, 'STATUS_CODE_OK',
  23. StatusCode=2, 'STATUS_CODE_ERROR',
  24. 'UNKNOWN') as StatusCode,
  25. StatusMessage,
  26. `Events.Timestamp`,
  27. `Events.Name`,
  28. `Events.Attributes`,
  29. `Links.TraceId`,
  30. `Links.SpanId`,
  31. `Links.TraceState`,
  32. `Links.Attributes`,
  33. HttpCode,
  34. HttpMethod,
  35. HttpURL,
  36. ContainerId,
  37. srcIP,
  38. srcPort,
  39. targetIP,
  40. targetPort,
  41. RPCName,
  42. dbStatement,
  43. dbConnectionString,
  44. AppAlias
  45. from otel.traces;