topics.ts 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  1. import {
  2. ConfigSource,
  3. ConsumerGroup,
  4. ConsumerGroupState,
  5. Topic,
  6. TopicConfig,
  7. TopicAnalysis,
  8. } from 'generated-sources';
  9. export const internalTopicPayload = {
  10. name: '__internal.topic',
  11. internal: true,
  12. partitionCount: 1,
  13. replicationFactor: 1,
  14. replicas: 1,
  15. inSyncReplicas: 1,
  16. segmentSize: 0,
  17. segmentCount: 1,
  18. underReplicatedPartitions: 0,
  19. partitions: [
  20. {
  21. partition: 0,
  22. leader: 1,
  23. replicas: [{ broker: 1, leader: false, inSync: true }],
  24. offsetMax: 0,
  25. offsetMin: 0,
  26. },
  27. ],
  28. };
  29. export const externalTopicPayload = {
  30. name: 'external.topic',
  31. internal: false,
  32. partitionCount: 1,
  33. replicationFactor: 1,
  34. replicas: 1,
  35. inSyncReplicas: 1,
  36. segmentSize: 1263,
  37. segmentCount: 1,
  38. underReplicatedPartitions: 0,
  39. partitions: [
  40. {
  41. partition: 0,
  42. leader: 1,
  43. replicas: [{ broker: 1, leader: false, inSync: true }],
  44. offsetMax: 0,
  45. offsetMin: 0,
  46. },
  47. ],
  48. };
  49. export const topicsPayload: Topic[] = [
  50. internalTopicPayload,
  51. externalTopicPayload,
  52. ];
  53. export const topicConsumerGroups: ConsumerGroup[] = [
  54. {
  55. groupId: 'amazon.msk.canary.group.broker-7',
  56. topics: 0,
  57. members: 0,
  58. simple: false,
  59. partitionAssignor: '',
  60. state: ConsumerGroupState.UNKNOWN,
  61. coordinator: { id: 1 },
  62. messagesBehind: 9,
  63. },
  64. {
  65. groupId: 'amazon.msk.canary.group.broker-4',
  66. topics: 0,
  67. members: 0,
  68. simple: false,
  69. partitionAssignor: '',
  70. state: ConsumerGroupState.COMPLETING_REBALANCE,
  71. coordinator: { id: 1 },
  72. messagesBehind: 9,
  73. },
  74. ];
  75. export const topicConfigPayload: TopicConfig[] = [
  76. {
  77. name: 'compression.type',
  78. value: 'producer',
  79. defaultValue: 'producer',
  80. source: ConfigSource.DYNAMIC_TOPIC_CONFIG,
  81. isSensitive: false,
  82. isReadOnly: false,
  83. synonyms: [
  84. {
  85. name: 'compression.type',
  86. value: 'producer',
  87. source: ConfigSource.DYNAMIC_TOPIC_CONFIG,
  88. },
  89. {
  90. name: 'compression.type',
  91. value: 'producer',
  92. source: ConfigSource.DEFAULT_CONFIG,
  93. },
  94. ],
  95. },
  96. {
  97. name: 'confluent.value.schema.validation',
  98. value: 'false',
  99. source: ConfigSource.DEFAULT_CONFIG,
  100. isSensitive: false,
  101. isReadOnly: false,
  102. synonyms: [],
  103. },
  104. {
  105. name: 'leader.replication.throttled.replicas',
  106. value: '',
  107. defaultValue: '',
  108. source: ConfigSource.DEFAULT_CONFIG,
  109. isSensitive: false,
  110. isReadOnly: false,
  111. synonyms: [],
  112. },
  113. {
  114. name: 'confluent.key.subject.name.strategy',
  115. value: 'io.confluent.kafka.serializers.subject.TopicNameStrategy',
  116. source: ConfigSource.DEFAULT_CONFIG,
  117. isSensitive: false,
  118. isReadOnly: false,
  119. synonyms: [],
  120. },
  121. {
  122. name: 'message.downconversion.enable',
  123. value: 'true',
  124. defaultValue: 'true',
  125. source: ConfigSource.DEFAULT_CONFIG,
  126. isSensitive: false,
  127. isReadOnly: false,
  128. synonyms: [
  129. {
  130. name: 'log.message.downconversion.enable',
  131. value: 'true',
  132. source: ConfigSource.DEFAULT_CONFIG,
  133. },
  134. ],
  135. },
  136. {
  137. name: 'min.insync.replicas',
  138. value: '1',
  139. defaultValue: '1',
  140. source: ConfigSource.DYNAMIC_TOPIC_CONFIG,
  141. isSensitive: false,
  142. isReadOnly: false,
  143. synonyms: [
  144. {
  145. name: 'min.insync.replicas',
  146. value: '1',
  147. source: ConfigSource.DYNAMIC_TOPIC_CONFIG,
  148. },
  149. {
  150. name: 'min.insync.replicas',
  151. value: '1',
  152. source: ConfigSource.DEFAULT_CONFIG,
  153. },
  154. ],
  155. },
  156. ];
  157. const topicStatsSize = {
  158. sum: 0,
  159. avg: 0,
  160. prctl50: 0,
  161. prctl75: 0,
  162. prctl95: 0,
  163. prctl99: 0,
  164. prctl999: 0,
  165. };
  166. export const topicStatsPayload: TopicAnalysis = {
  167. progress: {
  168. startedAt: 1659984559167,
  169. completenessPercent: 43,
  170. msgsScanned: 18077002,
  171. bytesScanned: 6750901718,
  172. },
  173. result: {
  174. startedAt: 1659984559095,
  175. finishedAt: 1659984617816,
  176. totalStats: {
  177. totalMsgs: 18194715,
  178. minOffset: 98869591,
  179. maxOffset: 100576010,
  180. minTimestamp: 1659719759485,
  181. maxTimestamp: 1659984603419,
  182. nullKeys: 18194715,
  183. nullValues: 0,
  184. approxUniqKeys: 0,
  185. approxUniqValues: 17817283,
  186. keySize: topicStatsSize,
  187. valueSize: topicStatsSize,
  188. hourlyMsgCounts: [
  189. { hourStart: 1659718800000, count: 16157 },
  190. { hourStart: 1659722400000, count: 225790 },
  191. ],
  192. },
  193. partitionStats: [
  194. {
  195. partition: 0,
  196. totalMsgs: 1515285,
  197. minOffset: 99060726,
  198. maxOffset: 100576010,
  199. minTimestamp: 1659722684090,
  200. maxTimestamp: 1659984603419,
  201. nullKeys: 1515285,
  202. nullValues: 0,
  203. approxUniqKeys: 0,
  204. approxUniqValues: 1515285,
  205. keySize: topicStatsSize,
  206. valueSize: topicStatsSize,
  207. hourlyMsgCounts: [
  208. { hourStart: 1659722400000, count: 18040 },
  209. { hourStart: 1659726000000, count: 20070 },
  210. ],
  211. },
  212. {
  213. partition: 1,
  214. totalMsgs: 1534422,
  215. minOffset: 98897827,
  216. maxOffset: 100432248,
  217. minTimestamp: 1659722803993,
  218. maxTimestamp: 1659984603416,
  219. nullKeys: 1534422,
  220. nullValues: 0,
  221. approxUniqKeys: 0,
  222. approxUniqValues: 1516431,
  223. keySize: topicStatsSize,
  224. valueSize: topicStatsSize,
  225. hourlyMsgCounts: [{ hourStart: 1659722400000, count: 19058 }],
  226. },
  227. ],
  228. },
  229. };