1 // pubsubplus-go-client 2 // 3 // Copyright 2021-2024 Solace Corporation. All rights reserved. 4 // 5 // Licensed under the Apache License, Version 2.0 (the "License"); 6 // you may not use this file except in compliance with the License. 7 // 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 // Package metrics contains the various metrics that can be retrieved as well as the 18 // interface for retrieving the metrics. 19 package metrics 20 21 // Metric represents the various metrics retrievable from a MessagingService's APIMetrics instance. 22 type Metric int 23 24 // The various metrics available. 25 const ( 26 // BrokerDiscardNotificationsReceived is the number of received messages 27 // with discard indication set. 28 BrokerDiscardNotificationsReceived Metric = iota 29 30 // CompressedBytesReceived is the number of bytes received before decompression. 31 CompressedBytesReceived 32 33 // ConnectionAttempts is the total number of TCP connection attempts. 34 ConnectionAttempts 35 36 // ControlBytesReceived is the number of control (non-data) messages received 37 // by the MessagingService. 38 ControlBytesReceived 39 40 // ControlBytesSent is the total number of control (non-data) bytes transmitted 41 // by the MessagingService. 42 ControlBytesSent 43 44 // ControlMessagesReceived is the total number of control (non-data) messages 45 // received by MessagingService. 46 ControlMessagesReceived 47 48 // ControlMessagesSent is the total number of control (non-data) messages 49 // transmitted by MessagingService. 50 ControlMessagesSent 51 52 // DirectBytesReceived is the number of direct messaging bytes received 53 // across all direct message publishers on the MessagingService. 54 DirectBytesReceived 55 56 // DirectBytesSent is the number of direct messaging bytes sent 57 // across all direct message publishers on the MessagingService. 58 DirectBytesSent 59 60 // DirectMessagesReceived is the number of direct messages received 61 // across all direct message publishers on the MessagingService. 62 DirectMessagesReceived 63 64 // DirectMessagesSent is the number of direct messages sent 65 // across all direct message publishers on the MessagingService. 66 DirectMessagesSent 67 68 // InternalDiscardNotifications is the number of messages received with 69 // internal discard notifications set. 70 InternalDiscardNotifications 71 72 // PersistentAcknowledgeSent is the number of acknowledgements 73 // sent for guaranteed messaging across all persistent message receivers 74 // on the MessagingService. 75 PersistentAcknowledgeSent 76 77 // PersistentBytesReceived is the number of persistent bytes received 78 // across all persistent message receivers on the Messaging Service. 79 PersistentBytesReceived 80 81 // PersistentBytesRedelivered is the number of persistent bytes 82 // redelivered across all persistent message publishers on the MessagingService. 83 PersistentBytesRedelivered 84 85 // PersistentBytesSent is the number of persistent bytes sent 86 // across all persistent message publishers on the MessagingService. 87 PersistentBytesSent 88 89 // The number of guaranteed messages dropped for being duplicates. 90 PersistentDuplicateMessagesDiscarded 91 92 // PersistentMessagesReceived is the number of persistent messages 93 // received across all persistent message receivers on the MessagingService. 94 PersistentMessagesReceived 95 96 // PersistentMessagesRedelivered is the number of persistent messages 97 // redelivered across all persistent message publishers on the MessagingService. 98 PersistentMessagesRedelivered 99 100 // PersistentMessagesSent is the number of persistent messages 101 // sent across all persistent message publishers on the MessagingService. 102 PersistentMessagesSent 103 104 // PersistentNoMatchingFlowMessagesDiscarded is the number of persistent 105 // messages discarded for not having a matching flow on the MessagingService. 106 PersistentNoMatchingFlowMessagesDiscarded 107 108 // PersistentOutOfOrderMessagesDiscarded is the number of persistent 109 // messages discarded for being received out of order across all 110 // persistent message receivers on the MessagingService. 111 PersistentOutOfOrderMessagesDiscarded 112 113 // PublishMessagesDiscarded is the number of messages discarded due to 114 // channel failure. 115 PublishMessagesDiscarded 116 117 // PublishedMessagesAcknowledged is the number of guaranteed messages that have 118 // been published and acknowledged across all persistent message receivers 119 // on the MessagingService 120 PublishedMessagesAcknowledged 121 122 // PublisherAcknowledgementReceived is the number of publisher acknowledgements 123 // received by all persistent message publishers on the MessagingService. 124 PublisherAcknowledgementReceived 125 126 // PublisherAcknowledgementTimeouts is the number of expired acknowledgement timers 127 // across all persistent message publishers on the MessagingService. 128 PublisherAcknowledgementTimeouts 129 130 // PublisherWindowClosed is the nunber of times the transmit window closed across 131 // all message publishers on the MessagingService. 132 PublisherWindowClosed 133 134 // The number of messages not accepted due to would block (non-blocking publish only). 135 PublisherWouldBlock 136 137 // TotalBytesReceived is the total number of bytes received by the MessagingService 138 // and all of its message receivers. 139 TotalBytesReceived 140 141 // TotalBytesSent is the total number of bytes sent by the MessagingService 142 // and all of its message publishers. 143 TotalBytesSent 144 145 // TotalMessagesReceived is the total number of messages received by the 146 // MessagingService and all of its receivers. 147 TotalMessagesReceived 148 149 // TotalMessagesSent is the total number of messages sent by the MessagingService 150 // and all of its publishers. 151 TotalMessagesSent 152 153 // TooBigMessagesDiscarded is the number of messages discarded due to being too large. 154 TooBigMessagesDiscarded 155 156 // UnknownParameterMessagesDiscarded is the number of messages discarded due to the 157 // presence of an unknown element or unknown protocol in the Solace Message Format 158 // (SMF) header. 159 UnknownParameterMessagesDiscarded 160 161 // ReceivedMessagesTerminationDiscarded is the number of messages discarded due to 162 // a receiver being terminated either by application initiated termination or 163 // failure event termination. 164 ReceivedMessagesTerminationDiscarded 165 166 // ReceivedMessagesBackpressureDiscarded is the number of messages discarded due to 167 // a receiver not having buffer space to queue a message 168 ReceivedMessagesBackpressureDiscarded 169 170 // PublishMessagesTerminationDiscarded is the number of messages discarded due to 171 // a publisher being terminated either by application initiated termination or 172 // failure event termination. 173 PublishMessagesTerminationDiscarded 174 175 // PublishMessagesBackpressureDiscarded is the number of messages discarded due to 176 // a publisher not having buffer space to queue a message when in a buffered 177 // backpressure configuration. 178 PublishMessagesBackpressureDiscarded 179 180 // MetricCount is the number of metrics defined by this package. 181 MetricCount int = iota 182 ) 183 184 // APIInfo allows for retrieval of various API properties transmitted to the Broker on connect. 185 type APIInfo interface { 186 // GetAPIBuildDate returns the build date of the current API in use. 187 GetAPIBuildDate() string 188 // GetAPIVersion returns the version of the current API in use. 189 GetAPIVersion() string 190 // GetAPIUserID returns the user ID transmitted to the broker. 191 GetAPIUserID() string 192 // GetAPIImplementationVendor returns the API implementation vendor transmitted to broker. 193 GetAPIImplementationVendor() string 194 } 195 196 // APIMetrics allows for retrieval of various metrics stored by the API. 197 type APIMetrics interface { 198 // GetValue will retrieve the value/count of the specified Metric. 199 GetValue(metric Metric) uint64 200 // Reset resets all metrics. 201 Reset() 202 } 203