rocketmq-client-nodejs 1.0.7 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (164) hide show
  1. package/README.md +61 -0
  2. package/dist/client/BaseClient.d.ts +36 -1
  3. package/dist/client/BaseClient.js +176 -12
  4. package/dist/client/RpcClient.js +14 -2
  5. package/dist/client/RpcClientManager.d.ts +5 -0
  6. package/dist/client/RpcClientManager.js +25 -8
  7. package/dist/client/TelemetrySession.js +45 -10
  8. package/dist/consumer/ConsumeResult.d.ts +2 -2
  9. package/dist/consumer/ConsumeResult.js +6 -3
  10. package/dist/consumer/ConsumeService.d.ts +2 -1
  11. package/dist/consumer/ConsumeService.js +7 -3
  12. package/dist/consumer/ConsumeTask.d.ts +6 -1
  13. package/dist/consumer/ConsumeTask.js +36 -5
  14. package/dist/consumer/Consumer.d.ts +13 -5
  15. package/dist/consumer/Consumer.js +85 -24
  16. package/dist/consumer/FifoConsumeService.d.ts +2 -1
  17. package/dist/consumer/FifoConsumeService.js +3 -3
  18. package/dist/consumer/LiteFifoConsumeService.d.ts +2 -1
  19. package/dist/consumer/LiteFifoConsumeService.js +3 -3
  20. package/dist/consumer/LitePushConsumerImpl.d.ts +12 -1
  21. package/dist/consumer/LitePushConsumerImpl.js +19 -4
  22. package/dist/consumer/LiteSimpleConsumer.d.ts +177 -0
  23. package/dist/consumer/LiteSimpleConsumer.js +126 -0
  24. package/dist/consumer/LiteSimpleConsumerImpl.d.ts +133 -0
  25. package/dist/consumer/LiteSimpleConsumerImpl.js +187 -0
  26. package/dist/consumer/LiteStandardConsumeService.d.ts +2 -1
  27. package/dist/consumer/LiteStandardConsumeService.js +3 -3
  28. package/dist/consumer/LiteSubscriptionManager.d.ts +27 -6
  29. package/dist/consumer/LiteSubscriptionManager.js +32 -24
  30. package/dist/consumer/ProcessQueue.d.ts +10 -0
  31. package/dist/consumer/ProcessQueue.js +47 -7
  32. package/dist/consumer/PushConsumer.d.ts +17 -0
  33. package/dist/consumer/PushConsumer.js +87 -7
  34. package/dist/consumer/PushConsumerGaugeObserver.d.ts +33 -0
  35. package/dist/consumer/PushConsumerGaugeObserver.js +60 -0
  36. package/dist/consumer/PushSubscriptionSettings.d.ts +8 -1
  37. package/dist/consumer/PushSubscriptionSettings.js +33 -6
  38. package/dist/consumer/SimpleConsumer.js +10 -1
  39. package/dist/consumer/StandardConsumeService.d.ts +2 -1
  40. package/dist/consumer/StandardConsumeService.js +3 -3
  41. package/dist/consumer/index.d.ts +1 -0
  42. package/dist/consumer/index.js +2 -1
  43. package/dist/exception/PayloadEmptyException.d.ts +20 -0
  44. package/dist/exception/PayloadEmptyException.js +28 -0
  45. package/dist/exception/StatusChecker.js +8 -1
  46. package/dist/exception/index.d.ts +1 -0
  47. package/dist/exception/index.js +2 -1
  48. package/dist/hook/Attribute.d.ts +26 -0
  49. package/dist/hook/Attribute.js +37 -0
  50. package/dist/hook/AttributeKey.d.ts +32 -0
  51. package/dist/hook/AttributeKey.js +43 -0
  52. package/dist/hook/CompositedMessageInterceptor.d.ts +31 -0
  53. package/dist/hook/CompositedMessageInterceptor.js +84 -0
  54. package/dist/hook/InflightRequestCountInterceptor.d.ts +28 -0
  55. package/dist/hook/InflightRequestCountInterceptor.js +44 -0
  56. package/dist/hook/MessageHookPoints.d.ts +54 -0
  57. package/dist/hook/MessageHookPoints.js +59 -0
  58. package/dist/hook/MessageHookPointsStatus.d.ts +24 -0
  59. package/dist/hook/MessageHookPointsStatus.js +29 -0
  60. package/dist/hook/MessageInterceptor.d.ts +34 -0
  61. package/dist/hook/MessageInterceptor.js +19 -0
  62. package/dist/hook/MessageInterceptorContext.d.ts +31 -0
  63. package/dist/hook/MessageInterceptorContext.js +19 -0
  64. package/dist/hook/MessageInterceptorContextImpl.d.ts +39 -0
  65. package/dist/hook/MessageInterceptorContextImpl.js +57 -0
  66. package/dist/hook/MessageMeterInterceptor.d.ts +39 -0
  67. package/dist/hook/MessageMeterInterceptor.js +149 -0
  68. package/dist/hook/index.d.ts +26 -0
  69. package/dist/hook/index.js +43 -0
  70. package/dist/index.d.ts +1 -0
  71. package/dist/index.js +2 -1
  72. package/dist/metrics/ClientMeter.d.ts +42 -0
  73. package/dist/metrics/ClientMeter.js +75 -0
  74. package/dist/metrics/ClientMeterManager.d.ts +42 -0
  75. package/dist/metrics/ClientMeterManager.js +127 -0
  76. package/dist/metrics/EmptyGaugeObserver.d.ts +28 -0
  77. package/dist/metrics/EmptyGaugeObserver.js +34 -0
  78. package/dist/metrics/GaugeEnum.d.ts +32 -0
  79. package/dist/metrics/GaugeEnum.js +37 -0
  80. package/dist/metrics/GaugeObserver.d.ts +29 -0
  81. package/dist/metrics/GaugeObserver.js +19 -0
  82. package/dist/metrics/HistogramEnum.d.ts +54 -0
  83. package/dist/metrics/HistogramEnum.js +71 -0
  84. package/dist/metrics/InvocationStatus.d.ts +26 -0
  85. package/dist/metrics/InvocationStatus.js +33 -0
  86. package/dist/metrics/Metric.d.ts +30 -0
  87. package/dist/metrics/Metric.js +44 -0
  88. package/dist/metrics/MetricLabels.d.ts +27 -0
  89. package/dist/metrics/MetricLabels.js +34 -0
  90. package/dist/metrics/index.d.ts +25 -0
  91. package/dist/metrics/index.js +42 -0
  92. package/dist/producer/Producer.js +33 -5
  93. package/dist/producer/PublishingLoadBalancer.js +9 -3
  94. package/dist/retry/CustomizedBackoffRetryPolicy.d.ts +37 -0
  95. package/dist/retry/CustomizedBackoffRetryPolicy.js +72 -0
  96. package/dist/retry/ExponentialBackoffRetryPolicy.js +10 -6
  97. package/dist/retry/RetryPolicy.d.ts +1 -1
  98. package/dist/retry/index.d.ts +1 -0
  99. package/dist/retry/index.js +2 -1
  100. package/dist/route/Endpoints.d.ts +6 -0
  101. package/dist/route/Endpoints.js +56 -4
  102. package/dist/route/IpNameResolver.d.ts +28 -0
  103. package/dist/route/IpNameResolver.js +104 -0
  104. package/dist/util/Semaphore.d.ts +47 -0
  105. package/dist/util/Semaphore.js +82 -0
  106. package/dist/util/index.js +6 -3
  107. package/package.json +6 -2
  108. package/src/client/BaseClient.ts +202 -12
  109. package/src/client/RpcClient.ts +14 -1
  110. package/src/client/RpcClientManager.ts +27 -8
  111. package/src/client/TelemetrySession.ts +47 -9
  112. package/src/consumer/ConsumeResult.ts +5 -2
  113. package/src/consumer/ConsumeService.ts +9 -2
  114. package/src/consumer/ConsumeTask.ts +43 -3
  115. package/src/consumer/Consumer.ts +103 -23
  116. package/src/consumer/FifoConsumeService.ts +4 -2
  117. package/src/consumer/LiteFifoConsumeService.ts +4 -2
  118. package/src/consumer/LitePushConsumerImpl.ts +21 -3
  119. package/src/consumer/LiteSimpleConsumer.ts +251 -0
  120. package/src/consumer/LiteSimpleConsumerImpl.ts +221 -0
  121. package/src/consumer/LiteStandardConsumeService.ts +4 -2
  122. package/src/consumer/LiteSubscriptionManager.ts +63 -36
  123. package/src/consumer/ProcessQueue.ts +54 -3
  124. package/src/consumer/PushConsumer.ts +98 -5
  125. package/src/consumer/PushConsumerGaugeObserver.ts +60 -0
  126. package/src/consumer/PushSubscriptionSettings.ts +38 -7
  127. package/src/consumer/SimpleConsumer.ts +9 -0
  128. package/src/consumer/StandardConsumeService.ts +4 -2
  129. package/src/consumer/index.ts +1 -0
  130. package/src/exception/PayloadEmptyException.ts +25 -0
  131. package/src/exception/StatusChecker.ts +7 -0
  132. package/src/exception/index.ts +1 -0
  133. package/src/hook/Attribute.ts +36 -0
  134. package/src/hook/AttributeKey.ts +42 -0
  135. package/src/hook/CompositedMessageInterceptor.ts +92 -0
  136. package/src/hook/InflightRequestCountInterceptor.ts +46 -0
  137. package/src/hook/MessageHookPoints.ts +55 -0
  138. package/src/hook/MessageHookPointsStatus.ts +25 -0
  139. package/src/hook/MessageInterceptor.ts +35 -0
  140. package/src/hook/MessageInterceptorContext.ts +33 -0
  141. package/src/hook/MessageInterceptorContextImpl.ts +68 -0
  142. package/src/hook/MessageMeterInterceptor.ts +162 -0
  143. package/src/hook/index.ts +27 -0
  144. package/src/index.ts +1 -0
  145. package/src/metrics/ClientMeter.ts +81 -0
  146. package/src/metrics/ClientMeterManager.ts +145 -0
  147. package/src/metrics/EmptyGaugeObserver.ts +36 -0
  148. package/src/metrics/GaugeEnum.ts +33 -0
  149. package/src/metrics/GaugeObserver.ts +32 -0
  150. package/src/metrics/HistogramEnum.ts +69 -0
  151. package/src/metrics/InvocationStatus.ts +28 -0
  152. package/src/metrics/Metric.ts +42 -0
  153. package/src/metrics/MetricLabels.ts +31 -0
  154. package/src/metrics/index.ts +26 -0
  155. package/src/producer/Producer.ts +37 -6
  156. package/src/producer/PublishingLoadBalancer.ts +8 -2
  157. package/src/retry/CustomizedBackoffRetryPolicy.ts +81 -0
  158. package/src/retry/ExponentialBackoffRetryPolicy.ts +11 -6
  159. package/src/retry/RetryPolicy.ts +1 -1
  160. package/src/retry/index.ts +1 -0
  161. package/src/route/Endpoints.ts +52 -3
  162. package/src/route/IpNameResolver.ts +119 -0
  163. package/src/util/Semaphore.ts +82 -0
  164. package/src/util/index.ts +5 -2
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Attributes } from '@opentelemetry/api';
18
+ import { Metadata } from '@grpc/grpc-js';
19
+ import { ILogger } from '../client/Logger';
20
+ import { GaugeObserver } from './GaugeObserver';
21
+ import { HistogramEnum } from './HistogramEnum';
22
+ import { Metric } from './Metric';
23
+ /**
24
+ * Owns the OpenTelemetry metric pipeline for a single client. On every settings
25
+ * command it lazily (re)builds an SdkMeterProvider that exports the four
26
+ * RocketMQ histograms plus the consumer gauges to the broker-supplied metric
27
+ * endpoints over OTLP/gRPC, mirroring
28
+ * org.apache.rocketmq.client.java.metrics.ClientMeterManager.
29
+ */
30
+ export declare class ClientMeterManager {
31
+ private readonly clientId;
32
+ private readonly metadataProvider;
33
+ private readonly logger;
34
+ private clientMeter;
35
+ private gaugeObserver;
36
+ constructor(clientId: string, metadataProvider: () => Metadata, logger: ILogger);
37
+ setGaugeObserver(gaugeObserver: GaugeObserver): void;
38
+ record(histogramEnum: HistogramEnum, attributes: Attributes, value: number): void;
39
+ isEnabled(): boolean;
40
+ shutdown(): Promise<void>;
41
+ reset(metric: Metric): Promise<void>;
42
+ }
@@ -0,0 +1,127 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.ClientMeterManager = void 0;
20
+ const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
21
+ const resources_1 = require("@opentelemetry/resources");
22
+ const exporter_metrics_otlp_grpc_1 = require("@opentelemetry/exporter-metrics-otlp-grpc");
23
+ const grpc_js_1 = require("@grpc/grpc-js");
24
+ const ClientMeter_1 = require("./ClientMeter");
25
+ const EmptyGaugeObserver_1 = require("./EmptyGaugeObserver");
26
+ const HistogramEnum_1 = require("./HistogramEnum");
27
+ const METRIC_EXPORTER_RPC_TIMEOUT = 5000;
28
+ const METRIC_READER_INTERVAL = 60000;
29
+ const METRIC_INSTRUMENTATION_NAME = 'org.apache.rocketmq.message';
30
+ /**
31
+ * Owns the OpenTelemetry metric pipeline for a single client. On every settings
32
+ * command it lazily (re)builds an SdkMeterProvider that exports the four
33
+ * RocketMQ histograms plus the consumer gauges to the broker-supplied metric
34
+ * endpoints over OTLP/gRPC, mirroring
35
+ * org.apache.rocketmq.client.java.metrics.ClientMeterManager.
36
+ */
37
+ class ClientMeterManager {
38
+ clientId;
39
+ metadataProvider;
40
+ logger;
41
+ clientMeter;
42
+ gaugeObserver = EmptyGaugeObserver_1.EmptyGaugeObserver.EMPTY;
43
+ constructor(clientId, metadataProvider, logger) {
44
+ this.clientId = clientId;
45
+ this.metadataProvider = metadataProvider;
46
+ this.logger = logger;
47
+ this.clientMeter = ClientMeter_1.ClientMeter.disabledInstance();
48
+ }
49
+ setGaugeObserver(gaugeObserver) {
50
+ this.gaugeObserver = gaugeObserver;
51
+ }
52
+ record(histogramEnum, attributes, value) {
53
+ this.clientMeter.record(histogramEnum, attributes, value);
54
+ }
55
+ isEnabled() {
56
+ return this.clientMeter.enabled;
57
+ }
58
+ async shutdown() {
59
+ await this.clientMeter.shutdown();
60
+ }
61
+ async reset(metric) {
62
+ try {
63
+ if (this.clientMeter.satisfy(metric)) {
64
+ this.logger.info('Metric settings is satisfied by the current message meter, metric=%j, clientId=%s', metric, this.clientId);
65
+ return;
66
+ }
67
+ if (!metric.on || !metric.endpoints) {
68
+ this.logger.info('Metric is off, clientId=%s', this.clientId);
69
+ await this.clientMeter.shutdown();
70
+ this.clientMeter = ClientMeter_1.ClientMeter.disabledInstance();
71
+ return;
72
+ }
73
+ const endpoints = metric.endpoints;
74
+ // Use the first address as the OTLP/gRPC target. The exporter's URL is
75
+ // normalized to "host:port" internally, which gRPC-js resolves through
76
+ // its default DNS resolver (a single IP works fine; the custom `ip`
77
+ // resolver is used for the primary RPC channels).
78
+ const address = endpoints.addressesList[0];
79
+ const url = `http://${address.host}:${address.port}`;
80
+ const exporter = new exporter_metrics_otlp_grpc_1.OTLPMetricExporter({
81
+ url,
82
+ credentials: grpc_js_1.ChannelCredentials.createInsecure(),
83
+ timeoutMillis: METRIC_EXPORTER_RPC_TIMEOUT,
84
+ // Per-request signing mirrors the Java client's AuthInterceptor. The
85
+ // d.ts types this field as `Metadata`, but the runtime (and the
86
+ // exporter's own merge logic in otlp-grpc-exporter-base) expects a
87
+ // function returning freshly-signed Metadata.
88
+ metadata: (() => this.metadataProvider()),
89
+ });
90
+ const reader = new sdk_metrics_1.PeriodicExportingMetricReader({
91
+ exporter,
92
+ exportIntervalMillis: METRIC_READER_INTERVAL,
93
+ exportTimeoutMillis: METRIC_EXPORTER_RPC_TIMEOUT,
94
+ });
95
+ const views = [
96
+ new sdk_metrics_1.View((0, HistogramEnum_1.buildHistogramView)(HistogramEnum_1.HistogramEnum.SEND_COST_TIME)),
97
+ new sdk_metrics_1.View((0, HistogramEnum_1.buildHistogramView)(HistogramEnum_1.HistogramEnum.DELIVERY_LATENCY)),
98
+ new sdk_metrics_1.View((0, HistogramEnum_1.buildHistogramView)(HistogramEnum_1.HistogramEnum.AWAIT_TIME)),
99
+ new sdk_metrics_1.View((0, HistogramEnum_1.buildHistogramView)(HistogramEnum_1.HistogramEnum.PROCESS_TIME)),
100
+ ];
101
+ const provider = new sdk_metrics_1.MeterProvider({
102
+ resource: resources_1.Resource.empty(),
103
+ readers: [reader],
104
+ views,
105
+ });
106
+ const meter = provider.getMeter(METRIC_INSTRUMENTATION_NAME);
107
+ const existedClientMeter = this.clientMeter;
108
+ this.clientMeter = new ClientMeter_1.ClientMeter(meter, endpoints, provider);
109
+ await existedClientMeter.shutdown();
110
+ this.logger.info('Metrics is on, endpoints=%s, clientId=%s', endpoints, this.clientId);
111
+ const gauges = this.gaugeObserver.getGauges();
112
+ for (const gauge of gauges) {
113
+ meter.createObservableGauge(gauge).addCallback(observableResult => {
114
+ const values = this.gaugeObserver.getValues(gauge);
115
+ for (const [attributes, value] of values) {
116
+ observableResult.observe(value, attributes);
117
+ }
118
+ });
119
+ }
120
+ }
121
+ catch (t) {
122
+ this.logger.error('Exception raised when resetting message meter, clientId=%s, error=%s', this.clientId, t);
123
+ }
124
+ }
125
+ }
126
+ exports.ClientMeterManager = ClientMeterManager;
127
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiQ2xpZW50TWV0ZXJNYW5hZ2VyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21ldHJpY3MvQ2xpZW50TWV0ZXJNYW5hZ2VyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUdILDREQUlvQztBQUNwQyx3REFBb0Q7QUFDcEQsMEZBQStFO0FBQy9FLDJDQUE2RDtBQUU3RCwrQ0FBNEM7QUFFNUMsNkRBQTBEO0FBQzFELG1EQUFvRTtBQUdwRSxNQUFNLDJCQUEyQixHQUFHLElBQUksQ0FBQztBQUN6QyxNQUFNLHNCQUFzQixHQUFHLEtBQUssQ0FBQztBQUNyQyxNQUFNLDJCQUEyQixHQUFHLDZCQUE2QixDQUFDO0FBRWxFOzs7Ozs7R0FNRztBQUNILE1BQWEsa0JBQWtCO0lBQ1osUUFBUSxDQUFTO0lBQ2pCLGdCQUFnQixDQUFpQjtJQUNqQyxNQUFNLENBQVU7SUFDekIsV0FBVyxDQUFjO0lBQ3pCLGFBQWEsR0FBa0IsdUNBQWtCLENBQUMsS0FBSyxDQUFDO0lBRWhFLFlBQVksUUFBZ0IsRUFBRSxnQkFBZ0MsRUFBRSxNQUFlO1FBQzdFLElBQUksQ0FBQyxRQUFRLEdBQUcsUUFBUSxDQUFDO1FBQ3pCLElBQUksQ0FBQyxnQ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UsQ0FBQztnQkFDM0IsS0FBSyxDQUFDLHFCQUFxQixDQUFDLEtBQUssQ0FBQyxDQUFDLFdBQVcsQ0FBQyxnQkFBZ0IsQ0FBQyxFQUFFO29CQUNoRSxNQUFNLE1BQU0sR0FBRyxJQUFJLENBQUMsYUFBYSxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsQ0FBQztvQkFDbkQsS0FBSyxNQUFNLENBQUUsVUFBVSxFQUFFLEtBQUssQ0FBRSxJQUFJLE1BQU0sRUFBRSxDQUFDO3dCQUMzQyxnQkFBZ0IsQ0FBQyxPQUFPLENBQUMsS0FBSyxFQUFFLFVBQVUsQ0FBQyxDQUFDO29CQUM5QyxDQUFDO2dCQUNILENBQUMsQ0FBQyxDQUFDO1lBQ0wsQ0FBQztRQUNILENBQUM7UUFBQyxPQUFPLENBQUMsRUFBRSxDQUFDO1lBQ1gsSUFBSSxDQUFDLE1BQU0sQ0FBQyxLQUFLLENBQUMsc0VBQXNFLEVBQUUsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUMsQ0FBQztRQUM5RyxDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBcEdELGdEQW9HQyJ9
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Attributes } from '@opentelemetry/api';
18
+ import { GaugeEnum } from './GaugeEnum';
19
+ import { GaugeObserver } from './GaugeObserver';
20
+ /**
21
+ * Default no-op gauge observer used before a consumer registers a real one,
22
+ * mirroring org.apache.rocketmq.client.java.metrics.EmptyGaugeObserver.
23
+ */
24
+ export declare class EmptyGaugeObserver implements GaugeObserver {
25
+ static readonly EMPTY: EmptyGaugeObserver;
26
+ getGauges(): GaugeEnum[];
27
+ getValues(): Map<Attributes, number>;
28
+ }
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.EmptyGaugeObserver = void 0;
20
+ /**
21
+ * Default no-op gauge observer used before a consumer registers a real one,
22
+ * mirroring org.apache.rocketmq.client.java.metrics.EmptyGaugeObserver.
23
+ */
24
+ class EmptyGaugeObserver {
25
+ static EMPTY = new EmptyGaugeObserver();
26
+ getGauges() {
27
+ return [];
28
+ }
29
+ getValues() {
30
+ return new Map();
31
+ }
32
+ }
33
+ exports.EmptyGaugeObserver = EmptyGaugeObserver;
34
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiRW1wdHlHYXVnZU9ic2VydmVyLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21ldHJpY3MvRW1wdHlHYXVnZU9ic2VydmVyLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQU1IOzs7R0FHRztBQUNILE1BQWEsa0JBQWtCO0lBQzdCLE1BQU0sQ0FBVSxLQUFLLEdBQXVCLElBQUksa0JBQWtCLEVBQUUsQ0FBQztJQUVyRSxTQUFTO1FBQ1AsT0FBTyxFQUFFLENBQUM7SUFDWixDQUFDO0lBRUQsU0FBUztRQUNQLE9BQU8sSUFBSSxHQUFHLEVBQUUsQ0FBQztJQUNuQixDQUFDOztBQVRILGdEQVVDIn0=
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * The two consumer gauges exported by the RocketMQ client, mirroring
19
+ * org.apache.rocketmq.client.java.metrics.GaugeEnum.
20
+ */
21
+ export declare enum GaugeEnum {
22
+ /**
23
+ * Cached message count of push consumer.
24
+ * Labels: topic, client_id, consumer_group.
25
+ */
26
+ CONSUMER_CACHED_MESSAGES = "rocketmq_consumer_cached_messages",
27
+ /**
28
+ * Cached message bytes of push consumer.
29
+ * Labels: topic, client_id, consumer_group.
30
+ */
31
+ CONSUMER_CACHED_BYTES = "rocketmq_consumer_cached_bytes"
32
+ }
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.GaugeEnum = void 0;
20
+ /**
21
+ * The two consumer gauges exported by the RocketMQ client, mirroring
22
+ * org.apache.rocketmq.client.java.metrics.GaugeEnum.
23
+ */
24
+ var GaugeEnum;
25
+ (function (GaugeEnum) {
26
+ /**
27
+ * Cached message count of push consumer.
28
+ * Labels: topic, client_id, consumer_group.
29
+ */
30
+ GaugeEnum["CONSUMER_CACHED_MESSAGES"] = "rocketmq_consumer_cached_messages";
31
+ /**
32
+ * Cached message bytes of push consumer.
33
+ * Labels: topic, client_id, consumer_group.
34
+ */
35
+ GaugeEnum["CONSUMER_CACHED_BYTES"] = "rocketmq_consumer_cached_bytes";
36
+ })(GaugeEnum || (exports.GaugeEnum = GaugeEnum = {}));
37
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR2F1Z2VFbnVtLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21ldHJpY3MvR2F1Z2VFbnVtLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVIOzs7R0FHRztBQUNILElBQVksU0FXWDtBQVhELFdBQVksU0FBUztJQUNuQjs7O09BR0c7SUFDSCwyRUFBOEQsQ0FBQTtJQUM5RDs7O09BR0c7SUFDSCxxRUFBd0QsQ0FBQTtBQUMxRCxDQUFDLEVBWFcsU0FBUyx5QkFBVCxTQUFTLFFBV3BCIn0=
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Attributes } from '@opentelemetry/api';
18
+ import { GaugeEnum } from './GaugeEnum';
19
+ /**
20
+ * Supplies the live values observed by the periodic metric reader for each
21
+ * consumer gauge, mirroring org.apache.rocketmq.client.java.metrics.GaugeObserver.
22
+ *
23
+ * The map key is the attribute set (topic / client_id / consumer_group) and the
24
+ * value is the observed gauge reading.
25
+ */
26
+ export interface GaugeObserver {
27
+ getGauges(): GaugeEnum[];
28
+ getValues(gauge: GaugeEnum): Map<Attributes, number>;
29
+ }
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiR2F1Z2VPYnNlcnZlci5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXRyaWNzL0dhdWdlT2JzZXJ2ZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRyJ9
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { ViewOptions } from '@opentelemetry/sdk-metrics';
18
+ /**
19
+ * The four histograms exported by the RocketMQ client, mirroring
20
+ * org.apache.rocketmq.client.java.metrics.HistogramEnum. The bucket
21
+ * boundaries (in milliseconds) are copied verbatim from the Java client.
22
+ */
23
+ export declare enum HistogramEnum {
24
+ /**
25
+ * Cost time of successful api calls of message publishing.
26
+ * Labels: topic, client_id, invocation_status.
27
+ */
28
+ SEND_COST_TIME = "rocketmq_send_cost_time",
29
+ /**
30
+ * Latency of message delivery from remote.
31
+ * Labels: topic, client_id, consumer_group.
32
+ */
33
+ DELIVERY_LATENCY = "rocketmq_delivery_latency",
34
+ /**
35
+ * Await time of message consumption.
36
+ * Labels: topic, client_id, consumer_group.
37
+ */
38
+ AWAIT_TIME = "rocketmq_await_time",
39
+ /**
40
+ * Process time of message consumption.
41
+ * Labels: topic, client_id, consumer_group, invocation_status.
42
+ */
43
+ PROCESS_TIME = "rocketmq_process_time"
44
+ }
45
+ /**
46
+ * Explicit bucket boundaries (milliseconds) for each histogram, identical to
47
+ * the Java client's Aggregation.explicitBucketHistogram(...) calls.
48
+ */
49
+ export declare const HISTOGRAM_BUCKETS: Record<HistogramEnum, number[]>;
50
+ /**
51
+ * Build the OpenTelemetry view that forces the given histogram onto the exact
52
+ * explicit-bucket aggregation used by the Java client.
53
+ */
54
+ export declare function buildHistogramView(histogramEnum: HistogramEnum): ViewOptions;
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.HISTOGRAM_BUCKETS = exports.HistogramEnum = void 0;
20
+ exports.buildHistogramView = buildHistogramView;
21
+ const sdk_metrics_1 = require("@opentelemetry/sdk-metrics");
22
+ /**
23
+ * The four histograms exported by the RocketMQ client, mirroring
24
+ * org.apache.rocketmq.client.java.metrics.HistogramEnum. The bucket
25
+ * boundaries (in milliseconds) are copied verbatim from the Java client.
26
+ */
27
+ var HistogramEnum;
28
+ (function (HistogramEnum) {
29
+ /**
30
+ * Cost time of successful api calls of message publishing.
31
+ * Labels: topic, client_id, invocation_status.
32
+ */
33
+ HistogramEnum["SEND_COST_TIME"] = "rocketmq_send_cost_time";
34
+ /**
35
+ * Latency of message delivery from remote.
36
+ * Labels: topic, client_id, consumer_group.
37
+ */
38
+ HistogramEnum["DELIVERY_LATENCY"] = "rocketmq_delivery_latency";
39
+ /**
40
+ * Await time of message consumption.
41
+ * Labels: topic, client_id, consumer_group.
42
+ */
43
+ HistogramEnum["AWAIT_TIME"] = "rocketmq_await_time";
44
+ /**
45
+ * Process time of message consumption.
46
+ * Labels: topic, client_id, consumer_group, invocation_status.
47
+ */
48
+ HistogramEnum["PROCESS_TIME"] = "rocketmq_process_time";
49
+ })(HistogramEnum || (exports.HistogramEnum = HistogramEnum = {}));
50
+ /**
51
+ * Explicit bucket boundaries (milliseconds) for each histogram, identical to
52
+ * the Java client's Aggregation.explicitBucketHistogram(...) calls.
53
+ */
54
+ exports.HISTOGRAM_BUCKETS = {
55
+ [HistogramEnum.SEND_COST_TIME]: [1.0, 5.0, 10.0, 20.0, 50.0, 200.0, 500.0],
56
+ [HistogramEnum.DELIVERY_LATENCY]: [1.0, 5.0, 10.0, 20.0, 50.0, 200.0, 500.0],
57
+ [HistogramEnum.AWAIT_TIME]: [1.0, 5.0, 20.0, 100.0, 1000.0, 5 * 1000.0, 10 * 1000.0],
58
+ [HistogramEnum.PROCESS_TIME]: [1.0, 5.0, 10.0, 100.0, 1000.0, 10 * 1000.0, 60 * 1000.0],
59
+ };
60
+ /**
61
+ * Build the OpenTelemetry view that forces the given histogram onto the exact
62
+ * explicit-bucket aggregation used by the Java client.
63
+ */
64
+ function buildHistogramView(histogramEnum) {
65
+ return {
66
+ instrumentName: histogramEnum,
67
+ instrumentType: sdk_metrics_1.InstrumentType.HISTOGRAM,
68
+ aggregation: new sdk_metrics_1.ExplicitBucketHistogramAggregation(exports.HISTOGRAM_BUCKETS[histogramEnum]),
69
+ };
70
+ }
71
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSGlzdG9ncmFtRW51bS5qcyIsInNvdXJjZVJvb3QiOiIiLCJz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SxJQUFJLEVBQUUsS0FBSyxFQUFFLE1BQU0sRUFBRSxFQUFFLEdBQUcsTUFBTSxFQUFFLEVBQUUsR0FBRyxNQUFNLENBQUU7Q0FDMUYsQ0FBQztBQUVGOzs7R0FHRztBQUNILFNBQWdCLGtCQUFrQixDQUFDLGFBQTRCO0lBQzdELE9BQU87UUFDTCxjQUFjLEVBQUUsYUFBYTtRQUM3QixjQUFjLEVBQUUsNEJBQWMsQ0FBQyxTQUFTO1FBQ3hDLFdBQVcsRUFBRSxJQUFJLGdEQUFrQyxDQUFDLHlCQUFpQixDQUFDLGFBQWEsQ0FBQyxDQUFDO0tBQ3RGLENBQUM7QUFDSixDQUFDIn0=
@@ -0,0 +1,26 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ /**
18
+ * Outcome of an instrumented operation (send / consume), mirroring
19
+ * org.apache.rocketmq.client.java.metrics.InvocationStatus.
20
+ */
21
+ export declare class InvocationStatus {
22
+ readonly name: string;
23
+ static readonly SUCCESS: InvocationStatus;
24
+ static readonly FAILURE: InvocationStatus;
25
+ private constructor();
26
+ }
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.InvocationStatus = void 0;
20
+ /**
21
+ * Outcome of an instrumented operation (send / consume), mirroring
22
+ * org.apache.rocketmq.client.java.metrics.InvocationStatus.
23
+ */
24
+ class InvocationStatus {
25
+ name;
26
+ static SUCCESS = new InvocationStatus('success');
27
+ static FAILURE = new InvocationStatus('failure');
28
+ constructor(name) {
29
+ this.name = name;
30
+ }
31
+ }
32
+ exports.InvocationStatus = InvocationStatus;
33
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiSW52b2NhdGlvblN0YXR1cy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9tZXRyaWNzL0ludm9jYXRpb25TdGF0dXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7Ozs7Ozs7Ozs7R0FlRzs7O0FBRUg7OztHQUdHO0FBQ0gsTUFBYSxnQkFBZ0I7SUFJRTtJQUg3QixNQUFNLENBQVUsT0FBTyxHQUFHLElBQUksZ0JBQWdCLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDMUQsTUFBTSxDQUFVLE9BQU8sR0FBRyxJQUFJLGdCQUFnQixDQUFDLFNBQVMsQ0FBQyxDQUFDO0lBRTFELFlBQTZCLElBQVk7UUFBWixTQUFJLEdBQUosSUFBSSxDQUFRO0lBQ3pDLENBQUM7O0FBTEgsNENBTUMifQ==
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Licensed to the Apache Software Foundation (ASF) under one or more
3
+ * contributor license agreements. See the NOTICE file distributed with
4
+ * this work for additional information regarding copyright ownership.
5
+ * The ASF licenses this file to You under the Apache License, Version 2.0
6
+ * (the "License"); you may not use this file except in compliance with
7
+ * the License. You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+ import { Endpoints } from '../route';
18
+ import { Metric as MetricPB } from '../../proto/apache/rocketmq/v2/definition_pb';
19
+ /**
20
+ * Local view of the metric switch received from the broker via the telemetry
21
+ * settings command, mirroring org.apache.rocketmq.client.java.metrics.Metric.
22
+ *
23
+ * Metrics are only considered enabled when both the `on` flag is set AND a
24
+ * valid endpoints is present.
25
+ */
26
+ export declare class Metric {
27
+ readonly endpoints: Endpoints | null;
28
+ readonly on: boolean;
29
+ constructor(metric: MetricPB | undefined | null);
30
+ }
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ /**
3
+ * Licensed to the Apache Software Foundation (ASF) under one or more
4
+ * contributor license agreements. See the NOTICE file distributed with
5
+ * this work for additional information regarding copyright ownership.
6
+ * The ASF licenses this file to You under the Apache License, Version 2.0
7
+ * (the "License"); you may not use this file except in compliance with
8
+ * the License. You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ exports.Metric = void 0;
20
+ const route_1 = require("../route");
21
+ /**
22
+ * Local view of the metric switch received from the broker via the telemetry
23
+ * settings command, mirroring org.apache.rocketmq.client.java.metrics.Metric.
24
+ *
25
+ * Metrics are only considered enabled when both the `on` flag is set AND a
26
+ * valid endpoints is present.
27
+ */
28
+ class Metric {
29
+ endpoints;
30
+ on;
31
+ constructor(metric) {
32
+ if (metric && metric.hasEndpoints() && metric.getOn()) {
33
+ // Endpoints expects the plain AsObject shape, so unwrap the proto message.
34
+ this.endpoints = new route_1.Endpoints(metric.getEndpoints().toObject());
35
+ this.on = true;
36
+ }
37
+ else {
38
+ this.endpoints = null;
39
+ this.on = false;
40
+ }
41
+ }
42
+ }
43
+ exports.Metric = Metric;
44
+ //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiTWV0cmljLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vc3JjL21ldHJpY3MvTWV0cmljLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7Ozs7Ozs7Ozs7Ozs7O0dBZUc7OztBQUVILG9DQUFxQztBQUdyQzs7Ozs7O0dBTUc7QUFDSCxNQUFhLE1BQU07SUFDUixTQUFTLENBQW1CO0lBQzVCLEVBQUUsQ0FBVTtJQUVyQixZQUFZLE1BQW1DO1FBQzdDLElBQUksTUFBTSxJQUFJLE1BQU0sQ0FBQyxZQUFZLEVBQUUsSUFBSSxNQUFNLENBQUMsS0FBSyxFQUFFLEVBQUUsQ0FBQztZQUN0RCwyRUFBMkU7WUFDM0UsSUFBSSxDQUFDLFNBQVMsR0FBRyxJQUFJLGlCQUFTLENBQUMsTUFBTSxDQUFDLFlBQVksRUFBRyxDQUFDLFFBQVEsRUFBRSxDQUFDLENBQUM7WUFDbEUsSUFBSSxDQUFDLEVBQUUsR0FBRyxJQUFJLENBQUM7UUFDakIsQ0FBQzthQUFNLENBQUM7WUFDTixJQUFJLENBQUMsU0FBUyxHQUFHLElBQUksQ0FBQztZQUN0QixJQUFJLENBQUMsRUFBRSxHQUFHLEtBQUssQ0FBQztRQUNsQixDQUFDO0lBQ0gsQ0FBQztDQUNGO0FBZEQsd0JBY0MifQ==