-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
df309b7
commit 732c946
Showing
9 changed files
with
67 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* c8 ignore start */ | ||
import { ValueType } from '@opentelemetry/api'; | ||
import { getMeter } from '@myrotvorets/otel-utils'; | ||
import type { Container } from './container.mjs'; | ||
|
||
type AsyncMetricOptions = Pick<Container, 'faceXClient' | 'meter'>; | ||
|
||
export function initAsyncMetrics({ meter, faceXClient }: AsyncMetricOptions): void { | ||
meter | ||
.createObservableUpDownCounter('facex.faces.count', { | ||
description: 'Number of stored faces', | ||
unit: '{count}', | ||
valueType: ValueType.INT, | ||
}) | ||
.addCallback(async (result) => { | ||
try { | ||
const r = await faceXClient.baseStatus(); | ||
result.observe(r.numberOfRecords); | ||
} catch { | ||
result.observe(NaN); | ||
} | ||
}); | ||
} | ||
|
||
export const requestDurationHistogram = getMeter().createHistogram('psbapi.request.duration', { | ||
description: 'Measures the duration of requests.', | ||
unit: 'ms', | ||
valueType: ValueType.DOUBLE, | ||
}); | ||
|
||
/* c8 ignore stop */ |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters