mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 09:09:36 +02:00
[clsi-cache] meter ingress and egress bandwidth (#27143)
* [mics] fix "app" label in clsi-cache metrics in dev-env * [clsi-cache] validate filePath when processing file * [clsi-cache] meter ingress and egress bandwidth Files are downloaded directly from nginx, hence we cannot meter egress in clsi-cache easily. GitOrigin-RevId: 24de8c41728f0e9c984113c1470dec6153e75f20
This commit is contained in:
@@ -145,6 +145,24 @@ class LoggerStream extends Transform {
|
||||
}
|
||||
}
|
||||
|
||||
class MeteredStream extends Transform {
|
||||
#Metrics
|
||||
#metric
|
||||
#labels
|
||||
|
||||
constructor(Metrics, metric, labels) {
|
||||
super()
|
||||
this.#Metrics = Metrics
|
||||
this.#metric = metric
|
||||
this.#labels = labels
|
||||
}
|
||||
|
||||
_transform(chunk, encoding, callback) {
|
||||
this.#Metrics.count(this.#metric, chunk.byteLength, 1, this.#labels)
|
||||
callback(null, chunk)
|
||||
}
|
||||
}
|
||||
|
||||
// Export our classes
|
||||
|
||||
module.exports = {
|
||||
@@ -153,6 +171,7 @@ module.exports = {
|
||||
LoggerStream,
|
||||
LimitedStream,
|
||||
TimeoutStream,
|
||||
MeteredStream,
|
||||
SizeExceededError,
|
||||
AbortError,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user