webhook-statistics.td 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. $ postgres-execute connection=postgres://mz_system:materialize@${testdrive.materialize-internal-sql-addr}
  10. ALTER SYSTEM SET storage_statistics_collection_interval = 1000
  11. ALTER SYSTEM SET storage_statistics_interval = 2000
  12. > CREATE CLUSTER webhook_cluster REPLICAS (r1 (SIZE '1'));
  13. > CREATE SOURCE webhook_text IN CLUSTER webhook_cluster FROM WEBHOOK
  14. BODY FORMAT TEXT;
  15. $ webhook-append database=materialize schema=public name=webhook_text
  16. a
  17. > SELECT
  18. s.name,
  19. u.messages_received,
  20. u.bytes_received > 0,
  21. u.updates_staged,
  22. u.updates_committed
  23. FROM mz_sources s
  24. JOIN mz_internal.mz_source_statistics u ON s.id = u.id
  25. WHERE s.name IN ('webhook_text')
  26. webhook_text 1 true 1 1
  27. $ set-from-sql var=bytes-received
  28. SELECT
  29. (u.bytes_received)::text
  30. FROM mz_sources s
  31. JOIN mz_internal.mz_source_statistics u ON s.id = u.id
  32. WHERE s.name IN ('webhook_text')
  33. $ webhook-append database=materialize schema=public name=webhook_text
  34. b
  35. > SELECT
  36. s.name,
  37. u.messages_received,
  38. u.bytes_received > ${bytes-received},
  39. u.updates_staged,
  40. u.updates_committed
  41. FROM mz_sources s
  42. JOIN mz_internal.mz_source_statistics u ON s.id = u.id
  43. WHERE s.name IN ('webhook_text')
  44. webhook_text 2 true 2 2
  45. > DROP SOURCE webhook_text CASCADE;
  46. > SELECT
  47. count(*)
  48. FROM mz_sources s
  49. JOIN mz_internal.mz_source_statistics u ON s.id = u.id
  50. WHERE s.name IN ('webhook_text')
  51. 0