metrics-cluster.td 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. $ set-sql-timeout duration=300s
  10. > CREATE CLUSTER foo REPLICAS (size_1 (SIZE '1'), size_32 (SIZE '32'), size_2_2 (SIZE '2-2'))
  11. > CREATE CLUSTER bar REPLICAS ()
  12. > CREATE CLUSTER xyzzy REPLICAS (size_4 (SIZE '4'))
  13. > SELECT
  14. c.name,
  15. r.name,
  16. u.process_id,
  17. u.cpu_percent >= 0.0,
  18. u.memory_percent > 0.0,
  19. u.disk_percent
  20. FROM
  21. mz_clusters AS c
  22. JOIN mz_cluster_replicas AS r ON r.cluster_id = c.id
  23. JOIN
  24. mz_internal.mz_cluster_replica_utilization AS u
  25. ON r.id = u.replica_id
  26. WHERE c.name IN ( 'foo', 'bar', 'xyzzy' )
  27. ORDER BY c.name, r.name, process_id
  28. foo size_1 0 true true <null>
  29. foo size_2_2 0 true true <null>
  30. foo size_2_2 1 true true <null>
  31. foo size_32 0 true true <null>
  32. xyzzy size_4 0 true true <null>
  33. > SELECT DISTINCT ON (c.name, r.name, u.process_id)
  34. c.name,
  35. r.name,
  36. u.process_id,
  37. u.cpu_percent >= 0.0,
  38. u.memory_percent > 0.0,
  39. u.disk_percent
  40. FROM
  41. mz_clusters AS c
  42. JOIN mz_cluster_replicas AS r ON r.cluster_id = c.id
  43. JOIN
  44. mz_internal.mz_cluster_replica_utilization_history AS u
  45. ON r.id = u.replica_id
  46. WHERE c.name IN ( 'foo', 'bar', 'xyzzy' )
  47. ORDER BY c.name, r.name, process_id, occurred_at DESC
  48. foo size_1 0 true true <null>
  49. foo size_2_2 0 true true <null>
  50. foo size_2_2 1 true true <null>
  51. foo size_32 0 true true <null>
  52. xyzzy size_4 0 true true <null>