Done : - move metrics and health cache services from health module to metrics module - refactor metrics counter from specific method to set up from enum keys - add OpenTelemetry (Otel) instrumentation for metrics - set up Otel SDK to send metrics to Otel collector To do later : - implement Otel instrumentation for traces + plug Sentry on top
14 lines
325 B
TypeScript
14 lines
325 B
TypeScript
export const parseArrayEnvVar = <T>(
|
|
envVar: string | undefined,
|
|
expectedValues: T[],
|
|
defaultValues: T[],
|
|
): T[] => {
|
|
if (!envVar) return defaultValues;
|
|
|
|
const values = envVar
|
|
.split(',')
|
|
.filter((item) => expectedValues.includes(item as T)) as T[];
|
|
|
|
return values.length > 0 ? values : defaultValues;
|
|
};
|