fix(deps): update typescript-projects (#9169)

* fix(deps): update typescript-projects

* fix: type error

* fix: more imports

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
This commit is contained in:
renovate[bot] 2024-04-30 09:49:14 -04:00 committed by GitHub
parent 3212069eec
commit 9e79a23bbe
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
7 changed files with 1649 additions and 979 deletions

View file

@ -1,13 +1,10 @@
import { Histogram, MetricOptions, ValueType, metrics } from '@opentelemetry/api';
import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-hooks';
import { PrometheusExporter } from '@opentelemetry/exporter-prometheus';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis';
import { NestInstrumentation } from '@opentelemetry/instrumentation-nestjs-core';
import { PgInstrumentation } from '@opentelemetry/instrumentation-pg';
import { Resource } from '@opentelemetry/resources';
import { ExplicitBucketHistogramAggregation, View } from '@opentelemetry/sdk-metrics';
import { NodeSDK } from '@opentelemetry/sdk-node';
import { NodeSDK, contextBase, metrics, resources } from '@opentelemetry/sdk-node';
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions';
import { snakeCase, startCase } from 'lodash';
import { OpenTelemetryModuleOptions } from 'nestjs-otel/lib/interfaces';
@ -31,7 +28,7 @@ if (!metricsEnabled && process.env.OTEL_SDK_DISABLED === undefined) {
process.env.OTEL_SDK_DISABLED = 'true';
}
const aggregation = new ExplicitBucketHistogramAggregation(
const aggregation = new metrics.ExplicitBucketHistogramAggregation(
[0.1, 0.25, 0.5, 0.75, 1, 2.5, 5, 7.5, 10, 25, 50, 75, 100, 250, 500, 750, 1000, 2500, 5000, 7500, 10_000],
true,
);
@ -39,7 +36,7 @@ const aggregation = new ExplicitBucketHistogramAggregation(
const metricsPort = Number.parseInt(process.env.IMMICH_METRICS_PORT ?? '8081');
export const otelSDK = new NodeSDK({
resource: new Resource({
resource: new resources.Resource({
[SemanticResourceAttributes.SERVICE_NAME]: `immich`,
[SemanticResourceAttributes.SERVICE_VERSION]: serverVersion.toString(),
}),
@ -51,7 +48,7 @@ export const otelSDK = new NodeSDK({
new NestInstrumentation(),
new PgInstrumentation(),
],
views: [new View({ aggregation, instrumentName: '*', instrumentUnit: 'ms' })],
views: [new metrics.View({ aggregation, instrumentName: '*', instrumentUnit: 'ms' })],
});
export const otelConfig: OpenTelemetryModuleOptions = {
@ -64,7 +61,11 @@ export const otelConfig: OpenTelemetryModuleOptions = {
},
};
function ExecutionTimeHistogram({ description, unit = 'ms', valueType = ValueType.DOUBLE }: MetricOptions = {}) {
function ExecutionTimeHistogram({
description,
unit = 'ms',
valueType = contextBase.ValueType.DOUBLE,
}: contextBase.MetricOptions = {}) {
return (target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor) => {
if (!repoMetrics || process.env.OTEL_SDK_DISABLED) {
return;
@ -79,7 +80,7 @@ function ExecutionTimeHistogram({ description, unit = 'ms', valueType = ValueTyp
description ??
`The elapsed time in ${unit} for the ${startCase(className)} to ${startCase(propertyName).toLowerCase()}`;
let histogram: Histogram | undefined;
let histogram: contextBase.Histogram | undefined;
descriptor.value = function (...args: any[]) {
const start = performance.now();
@ -89,7 +90,7 @@ function ExecutionTimeHistogram({ description, unit = 'ms', valueType = ValueTyp
.then(() => {
const end = performance.now();
if (!histogram) {
histogram = metrics
histogram = contextBase.metrics
.getMeter('immich')
.createHistogram(metricName, { description: metricDescription, unit, valueType });
}