瀏覽代碼

chore: Add Jaeger for dev-server

David Höck 9 月之前
父節點
當前提交
f04e60f56b
共有 4 個文件被更改,包括 178 次插入485 次删除
  1. 11 14
      docker-compose.yml
  2. 158 462
      package-lock.json
  3. 0 7
      packages/dev-server/dev-config.ts
  4. 9 2
      packages/dev-server/instrumentation.ts

+ 11 - 14
docker-compose.yml

@@ -102,21 +102,16 @@ services:
         ports:
             - '6379:6379'
 
-    zipkin:
-        image: openzipkin/zipkin:latest
-        container_name: zipkin
-        # Environment settings are defined here https://github.com/openzipkin/zipkin/blob/master/zipkin-server/README.md#environment-variables
-        environment:
-            - STORAGE_TYPE=mem
-        # Uncomment to enable self-tracing
-        # - SELF_TRACING_ENABLED=true
-        # Uncomment to increase heap size
-        # - JAVA_OPTS=-Xms128m -Xmx128m -XX:+ExitOnOutOfMemoryError
+    jaeger:
+        image: jaegertracing/all-in-one:latest
+        container_name: jaeger
         ports:
-            # Port used for the Zipkin UI and HTTP Api
-            - 9411:9411
-        # Uncomment to enable debug logging
-        # command: --logging.level.zipkin2=DEBUG
+            - '4318:4318' # OTLP HTTP receiver
+            - '16686:16686' # Web UI
+        environment:
+            - COLLECTOR_OTLP_ENABLED=true
+        volumes:
+            - jaeger_data:/badger
 
 volumes:
     postgres_16_data:
@@ -131,3 +126,5 @@ volumes:
         driver: local
     esdata:
         driver: local
+    jaeger_data:
+        driver: local

File diff suppressed because it is too large
+ 158 - 462
package-lock.json


+ 0 - 7
packages/dev-server/dev-config.ts

@@ -3,25 +3,18 @@ import { AdminUiPlugin } from '@vendure/admin-ui-plugin';
 import { AssetServerPlugin } from '@vendure/asset-server-plugin';
 import { ADMIN_API_PATH, API_PORT, SHOP_API_PATH } from '@vendure/common/lib/shared-constants';
 import {
-    Asset,
-    DefaultJobQueuePlugin,
     DefaultLogger,
     DefaultSearchPlugin,
     dummyPaymentHandler,
-    FacetValue,
     LanguageCode,
     LogLevel,
     VendureConfig,
 } from '@vendure/core';
-import { ElasticsearchPlugin } from '@vendure/elasticsearch-plugin';
 import { defaultEmailHandlers, EmailPlugin, FileBasedTemplateLoader } from '@vendure/email-plugin';
 import { BullMQJobQueuePlugin } from '@vendure/job-queue-plugin/package/bullmq';
 import 'dotenv/config';
-import { compileUiExtensions } from '@vendure/ui-devkit/compiler';
 import path from 'path';
 import { DataSourceOptions } from 'typeorm';
-
-import { MultivendorPlugin } from './example-plugins/multivendor-plugin/multivendor.plugin';
 import { ReviewsPlugin } from './test-plugins/reviews/reviews-plugin';
 
 /**

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

@@ -1,13 +1,20 @@
 import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
+import { resourceFromAttributes } from '@opentelemetry/resources';
 import { NodeSDK } from '@opentelemetry/sdk-node';
+import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
 import { getSdkConfiguration } from '@vendure/telemetry';
 
 const traceExporter = new OTLPTraceExporter({
     url: 'http://localhost:4318/v1/traces',
 });
 
-const config = getSdkConfiguration(true);
+const config = getSdkConfiguration(false, {
+    spanProcessors: [new BatchSpanProcessor(traceExporter)],
+    resource: resourceFromAttributes({
+        'service.name': 'vendure-dev-server',
+    }),
+});
 
 const sdk = new NodeSDK(config);
 
-//sdk.start();
+sdk.start();

Some files were not shown because too many files changed in this diff