* A default implementation of [ClientMetrics]module:metrics~ClientMetrics that exposes the driver events as * Node.js events. * * An instance of [DefaultMetrics]module:metrics~DefaultMetrics is configured by default in the client, * you can access this instance using [Cli
| 37 | * defaultMetrics.responses.on('increment', latency => myHistogram.record(latency)); |
| 38 | */ |
| 39 | class DefaultMetrics extends ClientMetrics { |
| 40 | /** |
| 41 | * Creates a new instance of [DefaultMetrics]{@link module:metrics~DefaultMetrics}. |
| 42 | */ |
| 43 | constructor() { |
| 44 | super(); |
| 45 | |
| 46 | /** |
| 47 | * Emits all the error events. |
| 48 | * <p>Use each of the properties to measure events of specific errors.</p> |
| 49 | * @type {EventEmitter} |
| 50 | * @property {EventEmitter} authentication Emits the authentication timeout error events. |
| 51 | * @property {EventEmitter} clientTimeout Emits the client timeout error events. |
| 52 | * @property {EventEmitter} connection Emits the connection error events. |
| 53 | * @property {EventEmitter} readTimeout Emits the read timeout error events obtained from the server. |
| 54 | * @property {EventEmitter} other Emits the error events, that are not part of the other categories. |
| 55 | * @property {EventEmitter} unavailable Emits the unavailable error events obtained from the server. |
| 56 | * @property {EventEmitter} writeTimeout Emits the write timeout error events obtained from the server |
| 57 | */ |
| 58 | this.errors = new EventEmitter(); |
| 59 | this.errors.authentication = new EventEmitter(); |
| 60 | this.errors.clientTimeout = new EventEmitter(); |
| 61 | this.errors.connection = new EventEmitter(); |
| 62 | this.errors.other = new EventEmitter(); |
| 63 | this.errors.readTimeout = new EventEmitter(); |
| 64 | this.errors.unavailable = new EventEmitter(); |
| 65 | this.errors.writeTimeout = new EventEmitter(); |
| 66 | |
| 67 | /** |
| 68 | * Emits all the retry events. |
| 69 | * <p>Use each of the properties to measure events of specific retries.</p> |
| 70 | * @type {EventEmitter} |
| 71 | * @property {EventEmitter} clientTimeout Emits when an execution is retried as a result of an client timeout. |
| 72 | * @property {EventEmitter} other Emits the error events, that are not part of the other categories. |
| 73 | * @property {EventEmitter} readTimeout Emits an execution is retried as a result of an read timeout error from the |
| 74 | * server (coordinator to replica). |
| 75 | * @property {EventEmitter} unavailable Emits an execution is retried as a result of an unavailable error from the |
| 76 | * server. |
| 77 | * @property {EventEmitter} writeTimeout Emits an execution is retried as a result of a write timeout error from the |
| 78 | * server (coordinator to replica). |
| 79 | */ |
| 80 | this.retries = new EventEmitter(); |
| 81 | this.retries.clientTimeout = new EventEmitter(); |
| 82 | this.retries.other = new EventEmitter(); |
| 83 | this.retries.readTimeout = new EventEmitter(); |
| 84 | this.retries.unavailable = new EventEmitter(); |
| 85 | this.retries.writeTimeout = new EventEmitter(); |
| 86 | |
| 87 | /** |
| 88 | * Emits events when a speculative execution is started. |
| 89 | * @type {EventEmitter} |
| 90 | */ |
| 91 | this.speculativeExecutions = new EventEmitter(); |
| 92 | |
| 93 | /** |
| 94 | * Emits events when an error is ignored by the retry policy. |
| 95 | * @type {EventEmitter} |
| 96 | */ |
nothing calls this directly
no outgoing calls
no test coverage detected