Parcourir la source

fix: Corrupted core build output

David Höck il y a 9 mois
Parent
commit
69428b5651

+ 2 - 0
package-lock.json

@@ -4926,6 +4926,7 @@
     },
     "node_modules/@clack/prompts/node_modules/is-unicode-supported": {
       "version": "1.3.0",
+      "extraneous": true,
       "inBundle": true,
       "license": "MIT",
       "engines": {
@@ -48407,6 +48408,7 @@
         "@nestjs/terminus": "~11.0.0",
         "@nestjs/typeorm": "~11.0.0",
         "@vendure/common": "3.2.2",
+        "@vendure/telemetry": "3.2.2",
         "bcrypt": "^5.1.1",
         "body-parser": "^1.20.2",
         "cookie-session": "^2.1.0",

+ 1 - 0
packages/core/build/tsconfig.build.json

@@ -5,5 +5,6 @@
         "outDir": "../dist",
         "rootDirs": ["../src"]
     },
+    "exclude": ["../package.json"],
     "files": ["../src/index.ts", "../typings.d.ts"]
 }

+ 1 - 0
packages/core/package.json

@@ -50,6 +50,7 @@
         "@nestjs/terminus": "~11.0.0",
         "@nestjs/typeorm": "~11.0.0",
         "@vendure/common": "3.2.2",
+        "@vendure/telemetry": "3.2.2",
         "bcrypt": "^5.1.1",
         "body-parser": "^1.20.2",
         "cookie-session": "^2.1.0",

+ 2 - 2
packages/core/src/instrumentation.ts

@@ -1,8 +1,8 @@
 import { trace } from '@opentelemetry/api';
 import { createSpanDecorator } from '@vendure/telemetry';
 
-import pkg from '../package.json';
+import { VENDURE_VERSION } from './version';
 
-export const tracer = trace.getTracer(pkg.name, pkg.version);
+export const tracer = trace.getTracer('@vendure/core', VENDURE_VERSION);
 
 export const Span = createSpanDecorator(tracer);

+ 2 - 2
packages/dev-server/instrumentation.ts

@@ -6,8 +6,8 @@ const traceExporter = new OTLPTraceExporter({
     url: 'http://localhost:4318/v1/traces',
 });
 
-const config = getSdkConfiguration(true, true);
+const config = getSdkConfiguration(true);
 
 const sdk = new NodeSDK(config);
 
-sdk.start();
+//sdk.start();

+ 0 - 1
packages/telemetry/src/index.ts

@@ -1,5 +1,4 @@
 export * from './decorator/span';
 export * from './instrumentation';
-export * from './tracing.plugin';
 export * from './tracing/trace.service';
 export * from './utils/span';

+ 1 - 4
packages/telemetry/src/instrumentation.ts

@@ -3,10 +3,8 @@ import { AsyncLocalStorageContextManager } from '@opentelemetry/context-async-ho
 import { resourceFromAttributes } from '@opentelemetry/resources';
 import { NodeSDKConfiguration } from '@opentelemetry/sdk-node';
 import { ConsoleSpanExporter, SimpleSpanProcessor } from '@opentelemetry/sdk-trace-base';
-import { VENDURE_VERSION } from '@vendure/core';
 
 export function getSdkConfiguration(
-    instrumentationEnabled: boolean = true,
     devMode: boolean = false,
     config: Partial<NodeSDKConfiguration> = {},
 ): Partial<NodeSDKConfiguration> {
@@ -23,13 +21,12 @@ export function getSdkConfiguration(
     return {
         resource: resourceFromAttributes({
             'service.name': 'vendure',
-            'service.version': VENDURE_VERSION,
             'service.namespace': 'vendure',
             'service.environment': process.env.NODE_ENV || 'development',
         }),
         ...devModeAwareConfig,
         contextManager: new AsyncLocalStorageContextManager(),
-        instrumentations: instrumentationEnabled ? [getNodeAutoInstrumentations()] : [],
+        instrumentations: [getNodeAutoInstrumentations()],
         ...rest,
     };
 }

+ 0 - 17
packages/telemetry/src/tracing.plugin.ts

@@ -1,17 +0,0 @@
-import { PluginCommonModule, VendurePlugin } from '@vendure/core';
-
-import { TraceService } from './tracing/trace.service';
-import { TracingPluginOptions } from './types';
-
-@VendurePlugin({
-    imports: [PluginCommonModule],
-    providers: [TraceService],
-    exports: [TraceService],
-})
-export class TracingPlugin {
-    static options: TracingPluginOptions;
-
-    static init(options: TracingPluginOptions) {
-        this.options = options;
-    }
-}