Skip to content

Commit

Permalink
fixing checkout-api packages incompatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
jurabek committed Dec 30, 2023
1 parent 09afc13 commit 20eb464
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3,296 deletions.
25 changes: 10 additions & 15 deletions src/backend/services/checkout-api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,15 @@
"scripts": {
"start": "nodemon src/index.ts",
"build": "tsc",
"tslint": "./node_modules/.bin/tslint --project tsconfig.json"
"tslint": "./node_modules/.bin/tslint --project tsconfig.json",
"gen:grpc": "sh genproto.sh"
},
"devDependencies": {
"@types/chai": "^4.3.4",
"@types/express": "^4.17.17",
"@types/mocha": "^10.0.1",
"@types/node": "^20.10.0",
"@types/sinon": "^17.0.2",
"@types/swagger-jsdoc": "^6.0.1",
"@types/swagger-ui-express": "^4.1.3",
"chai": "^4.3.7",
"express": "^4.18.2",
"mocha": "^10.2.0",
Expand All @@ -29,19 +28,15 @@
"dependencies": {
"@grpc/grpc-js": "^1.8.13",
"@grpc/proto-loader": "^0.7.6",
"@opentelemetry/api": "^1.6.0",
"@opentelemetry/auto-instrumentations-node": "^0.40.1",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.45.1",
"@opentelemetry/exporter-trace-otlp-grpc": "^0.45.1",
"@opentelemetry/exporter-trace-otlp-http": "^0.45.1",
"@opentelemetry/instrumentation-express": "^0.33.3",
"@opentelemetry/sdk-metrics": "^1.18.1",
"@opentelemetry/sdk-node": "^0.45.1",
"@opentelemetry/api": "^1.7.0",
"@opentelemetry/auto-instrumentations-node": "^0.40.2",
"@opentelemetry/exporter-metrics-otlp-proto": "^0.46.0",
"@opentelemetry/exporter-trace-otlp-proto": "^0.46.0",
"@opentelemetry/sdk-metrics": "^1.19.0",
"@opentelemetry/sdk-node": "^0.46.0",
"dotenv": "^16.0.3",
"kafkajs": "^2.2.4",
"opentelemetry-instrumentation-kafkajs": "^0.40.0",
"pino": "^8.11.0",
"swagger-jsdoc": "^6.2.8",
"swagger-ui-express": "^5.0.0"
"pino": "^8.11.0"
}
}
}
30 changes: 0 additions & 30 deletions src/backend/services/checkout-api/src/swagger.ts

This file was deleted.

28 changes: 11 additions & 17 deletions src/backend/services/checkout-api/src/tracer.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
import { BatchSpanProcessor, SimpleSpanProcessor, ConsoleSpanExporter } from '@opentelemetry/sdk-trace-base';
import { registerInstrumentations } from '@opentelemetry/instrumentation';
import { GrpcInstrumentation } from '@opentelemetry/instrumentation-grpc';
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
import { ExpressInstrumentation } from '@opentelemetry/instrumentation-express';
import { trace } from '@opentelemetry/api';
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-grpc';
import { Resource } from "@opentelemetry/resources";
import { SemanticResourceAttributes } from "@opentelemetry/semantic-conventions";
import { diag, DiagConsoleLogger, DiagLogLevel } from '@opentelemetry/api';
import { KafkaJsInstrumentation } from 'opentelemetry-instrumentation-kafkajs';
import { NodeSDK } from '@opentelemetry/sdk-node';
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node';
import { ConsoleMetricExporter, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
import { PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-proto';

export const OpenTelemetry = (serviceName: string) => {
Expand All @@ -25,13 +17,19 @@ export const OpenTelemetry = (serviceName: string) => {
})
);

const processor = new BatchSpanProcessor(new OTLPTraceExporter({
const traceExporter = new OTLPTraceExporter({
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
}));
});

const metricReader = new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
}),
});

return new NodeSDK({
resource,
spanProcessor: processor,
traceExporter,
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-fs': {
Expand All @@ -40,10 +38,6 @@ export const OpenTelemetry = (serviceName: string) => {
}),
new KafkaJsInstrumentation()
],
metricReader: new PeriodicExportingMetricReader({
exporter: new OTLPMetricExporter({
url: process.env.OTEL_EXPORTER_OTLP_ENDPOINT,
}),
}),
metricReader,
})
}
Loading

0 comments on commit 20eb464

Please sign in to comment.