Browse Source

modify key

Yuki Takei 1 year ago
parent
commit
b4cbb22cb8

+ 4 - 4
apps/app/src/server/crowi/opentelemetry.ts

@@ -31,7 +31,7 @@ export class OpenTelemetry {
     return {
     return {
       resource: new Resource({
       resource: new Resource({
         [SEMRESATTRS_SERVICE_NAME]: this.name,
         [SEMRESATTRS_SERVICE_NAME]: this.name,
-        [SEMRESATTRS_SERVICE_INSTANCE_ID]: configManager.getConfig('crowi', 'instrumentation:serviceInstanceId'),
+        [SEMRESATTRS_SERVICE_INSTANCE_ID]: configManager.getConfig('crowi', 'otel:serviceInstanceId'),
         [SEMRESATTRS_SERVICE_VERSION]: this.version,
         [SEMRESATTRS_SERVICE_VERSION]: this.version,
       }),
       }),
       traceExporter: new OTLPTraceExporter(),
       traceExporter: new OTLPTraceExporter(),
@@ -54,9 +54,9 @@ export class OpenTelemetry {
    * Since otel library sees it.
    * Since otel library sees it.
    */
    */
   private overwriteSdkDisabled(): void {
   private overwriteSdkDisabled(): void {
-    const instrumentationEnabled = configManager.getConfig('crowi', 'instrumentation:enabled');
-    if (instrumentationEnabled != null && instrumentationEnabled === false) {
-      logger.warn("OTEL_SDK_DISABLED is set 'true' since GROWI's 'instrumentation:enabled' config is false.");
+    const instrumentationEnabled = configManager.getConfig('crowi', 'otel:enabled');
+    if (instrumentationEnabled === false) {
+      logger.warn("OTEL_SDK_DISABLED will be set 'true' since GROWI's 'otel:enabled' config is false.");
       process.env.OTEL_SDK_DISABLED = 'true';
       process.env.OTEL_SDK_DISABLED = 'true';
     }
     }
   }
   }

+ 10 - 4
apps/app/src/server/service/config-loader.ts

@@ -723,17 +723,23 @@ const ENV_VAR_NAME_TO_CONFIG_INFO = {
     type: ValueType.NUMBER,
     type: ValueType.NUMBER,
     default: 172800, // 2 days
     default: 172800, // 2 days
   },
   },
-  OPENTELEMETRY_INSTRUMENTATION_ENABLED: {
+  OPENTELEMETRY_ENABLED: {
     ns: 'crowi',
     ns: 'crowi',
-    key: 'instrumentation:enabled',
+    key: 'otel:enabled',
     type: ValueType.BOOLEAN,
     type: ValueType.BOOLEAN,
-    default: null,
+    default: true,
+  },
+  OPENTELEMETRY_IS_APP_SITE_URL_HASHED: {
+    ns: 'crowi',
+    key: 'otel:isAppSiteUrlHashed',
+    type: ValueType.BOOLEAN,
+    default: false,
   },
   },
   // TODO: fix after the decision of the instrumentation data specification
   // TODO: fix after the decision of the instrumentation data specification
   // https://redmine.weseek.co.jp/issues/144351
   // https://redmine.weseek.co.jp/issues/144351
   OPENTELEMETRY_SERVICE_INSTANCE_ID: {
   OPENTELEMETRY_SERVICE_INSTANCE_ID: {
     ns: 'crowi',
     ns: 'crowi',
-    key: 'instrumentation:serviceInstanceId',
+    key: 'otel:serviceInstanceId',
     type: ValueType.STRING,
     type: ValueType.STRING,
     default: null,
     default: null,
   },
   },