Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 9x 1x 1x 1x | import { TelemetrySink } from '@/types/capabilities/telemetry/TelemetrySink'
/**
* @class
*
* A telemetry sink that records nothing.
*
* @remarks
* Reports `false` from every write, the same answer a real sink gives when its
* backend is unbound or metrics are switched off — so a caller that logs the
* difference keeps logging it, and one that ignores it keeps working.
*
* The natural choice for tests: asserting on what a service *did* rarely means
* asserting on what it measured, and a sink that no-ops keeps measurement out
* of the assertion.
*
* @typeParam TRuntime The runtime handle, ignored throughout.
*
* @author Bayu Dwiyan Satria
* @version 1.0.0
* @since 1.0.0
*/
export class NoopTelemetrySink<TRuntime = unknown> implements TelemetrySink<TRuntime> {
/**
* Discards the measurement.
*
* @returns `false`.
*/
public request(): boolean {
return false
}
/**
* Discards the metric.
*
* @returns `false`.
*/
public event(): boolean {
return false
}
/**
* Never available.
*
* @returns `false`.
*/
public isAvailable(): boolean {
return false
}
}
|