Browse Source

Merge pull request #11198 from growilabs/refactor/otel-remove-installed-at-resource-attributes

imprv(otel): Drop growi.installedAt resource attributes
Yuki Takei 11 hours ago
parent
commit
78505e4ea0

+ 1 - 30
apps/app/src/features/opentelemetry/server/custom-resource-attributes/application-resource-attributes.spec.ts

@@ -27,8 +27,6 @@ describe('getApplicationResourceAttributes', () => {
       deploymentType: 'standalone',
       additionalInfo: {
         attachmentType: 'local',
-        installedAt: new Date('2023-01-01T00:00:00.000Z'),
-        installedAtByOldestUser: new Date('2023-01-01T00:00:00.000Z'),
       },
     };
 
@@ -40,11 +38,9 @@ describe('getApplicationResourceAttributes', () => {
       'growi.service.type': 'app',
       'growi.deployment.type': 'standalone',
       'growi.attachment.type': 'local',
-      'growi.installedAt': '2023-01-01T00:00:00.000Z',
-      'growi.installedAt.by_oldest_user': '2023-01-01T00:00:00.000Z',
     });
     expect(mockGrowiInfoService.getGrowiInfo).toHaveBeenCalledWith({
-      includeInstalledInfo: true,
+      includeAttachmentInfo: true,
     });
   });
 
@@ -63,8 +59,6 @@ describe('getApplicationResourceAttributes', () => {
       'growi.service.type': 'app',
       'growi.deployment.type': 'standalone',
       'growi.attachment.type': undefined,
-      'growi.installedAt': undefined,
-      'growi.installedAt.by_oldest_user': undefined,
     });
   });
 
@@ -77,27 +71,4 @@ describe('getApplicationResourceAttributes', () => {
 
     expect(result).toEqual({});
   });
-
-  it('should handle partial additionalInfo data', async () => {
-    const mockGrowiInfo = {
-      type: 'app',
-      deploymentType: 'docker',
-      additionalInfo: {
-        attachmentType: 'gridfs',
-        // Missing installedAt and installedAtByOldestUser
-      },
-    };
-
-    mockGrowiInfoService.getGrowiInfo.mockResolvedValue(mockGrowiInfo);
-
-    const result = await getApplicationResourceAttributes();
-
-    expect(result).toEqual({
-      'growi.service.type': 'app',
-      'growi.deployment.type': 'docker',
-      'growi.attachment.type': 'gridfs',
-      'growi.installedAt': undefined,
-      'growi.installedAt.by_oldest_user': undefined,
-    });
-  });
 });

+ 1 - 6
apps/app/src/features/opentelemetry/server/custom-resource-attributes/application-resource-attributes.ts

@@ -18,7 +18,7 @@ export async function getApplicationResourceAttributes(): Promise<Attributes> {
     const { growiInfoService } = await import('~/server/service/growi-info');
 
     const growiInfo = await growiInfoService.getGrowiInfo({
-      includeInstalledInfo: true,
+      includeAttachmentInfo: true,
     });
 
     const attributes: Attributes = {
@@ -26,11 +26,6 @@ export async function getApplicationResourceAttributes(): Promise<Attributes> {
       'growi.service.type': growiInfo.type,
       'growi.deployment.type': growiInfo.deploymentType,
       'growi.attachment.type': growiInfo.additionalInfo?.attachmentType,
-
-      // Installation information (fixed values)
-      'growi.installedAt': growiInfo.additionalInfo?.installedAt?.toISOString(),
-      'growi.installedAt.by_oldest_user':
-        growiInfo.additionalInfo?.installedAtByOldestUser?.toISOString(),
     };
 
     logger.info({ attributes }, 'Application resource attributes collected');

+ 0 - 2
apps/app/src/features/opentelemetry/server/node-sdk.spec.ts

@@ -31,8 +31,6 @@ vi.mock('~/server/service/growi-info', () => ({
       deploymentType: 'standalone',
       additionalInfo: {
         attachmentType: 'local',
-        installedAt: new Date('2023-01-01T00:00:00.000Z'),
-        installedAtByOldestUser: new Date('2023-01-01T00:00:00.000Z'),
       },
     }),
   },