diff --git a/src/artifactexporter/ArtifactExporter.ts b/src/artifactexporter/ArtifactExporter.ts index 3c02462c..46a2a046 100644 --- a/src/artifactexporter/ArtifactExporter.ts +++ b/src/artifactexporter/ArtifactExporter.ts @@ -6,6 +6,7 @@ import { DocumentType } from '../document/Document'; import { parseDocumentContent } from '../document/DocumentUtils'; import { S3Service } from '../services/S3Service'; import { Artifact } from '../stacks/actions/StackActionRequestType'; +import { Measure } from '../telemetry/TelemetryDecorator'; import { isS3Url, RESOURCE_EXPORTER_MAP } from './ResourceExporters'; export type ArtifactWithProperty = { @@ -81,6 +82,7 @@ export class ArtifactExporter { return artifactMap; } + @Measure({ name: 'getTemplateArtifacts' }) getTemplateArtifacts(): Artifact[] { const artifactMap = this.getResourceMapWithArtifact(); const result: Artifact[] = []; @@ -117,6 +119,7 @@ export class ArtifactExporter { return result; } + @Measure({ name: 'exportArtifact' }) async export(bucketName: string, s3KeyPrefix: string = ''): Promise { if ( this.templateDict === undefined || diff --git a/src/services/CfnService.ts b/src/services/CfnService.ts index a637e79b..deec8438 100644 --- a/src/services/CfnService.ts +++ b/src/services/CfnService.ts @@ -62,7 +62,7 @@ import { import { WaiterConfiguration, WaiterResult } from '@smithy/util-waiter'; import { AwsClientSettings, DefaultSettings } from '../settings/Settings'; import { DeploymentMode } from '../stacks/actions/StackActionRequestType'; -import { Count } from '../telemetry/TelemetryDecorator'; +import { Count, Measure } from '../telemetry/TelemetryDecorator'; import { AwsClient } from './AwsClient'; export class CfnService { @@ -174,6 +174,7 @@ export class CfnService { }); } + @Count({ name: 'detectStackDrift' }) public async detectStackDrift(params: { StackName: string; LogicalResourceIds?: string[]; @@ -256,6 +257,7 @@ export class CfnService { return await this.withClient((client) => client.send(new ListStackResourcesCommand(params))); } + @Count({ name: 'describeStackResourceDrifts' }) public async describeStackResourceDrifts(params: { StackName: string; StackResourceDriftStatusFilters?: StackResourceDriftStatus[]; @@ -337,6 +339,7 @@ export class CfnService { return await this.withClient((client) => client.send(new DeleteStackCommand(params))); } + @Measure({ name: 'waitUntilChangeSetCreateComplete' }) public async waitUntilChangeSetCreateComplete(params: DescribeChangeSetCommandInput): Promise { return await this.withClient(async (client) => { const settings = this.awsClientSettings; @@ -350,6 +353,7 @@ export class CfnService { }); } + @Measure({ name: 'waitUntilStackCreateComplete' }) public async waitUntilStackCreateComplete(params: DescribeStacksCommandInput): Promise { return await this.withClient(async (client) => { const settings = this.awsClientSettings; @@ -363,6 +367,7 @@ export class CfnService { }); } + @Measure({ name: 'waitUntilStackUpdateComplete' }) public async waitUntilStackUpdateComplete(params: DescribeStacksCommandInput): Promise { return await this.withClient(async (client) => { const settings = this.awsClientSettings; @@ -376,6 +381,7 @@ export class CfnService { }); } + @Measure({ name: 'waitUntilStackImportComplete' }) public async waitUntilStackImportComplete(params: DescribeStacksCommandInput): Promise { return await this.withClient(async (client) => { const settings = this.awsClientSettings; @@ -389,6 +395,7 @@ export class CfnService { }); } + @Measure({ name: 'waitUntilStackDeleteComplete' }) public async waitUntilStackDeleteComplete(params: DescribeStacksCommandInput): Promise { return await this.withClient(async (client) => { const settings = this.awsClientSettings; diff --git a/src/stacks/actions/ChangeSetDeletionWorkflow.ts b/src/stacks/actions/ChangeSetDeletionWorkflow.ts index 4acc1818..d32bc7ca 100644 --- a/src/stacks/actions/ChangeSetDeletionWorkflow.ts +++ b/src/stacks/actions/ChangeSetDeletionWorkflow.ts @@ -5,6 +5,7 @@ import { CfnExternal } from '../../server/CfnExternal'; import { CfnInfraCore } from '../../server/CfnInfraCore'; import { CfnService } from '../../services/CfnService'; import { LoggerFactory } from '../../telemetry/LoggerFactory'; +import { Measure } from '../../telemetry/TelemetryDecorator'; import { extractErrorMessage } from '../../utils/Errors'; import { processWorkflowUpdates, mapChangesToStackChanges, isStackInReview } from './StackActionOperations'; import { @@ -29,6 +30,7 @@ export class ChangeSetDeletionWorkflow protected readonly documentManager: DocumentManager, ) {} + @Measure({ name: 'changeSetDeletionWorkflow' }) async start(params: CreateDeploymentParams): Promise { const describeChangeSetResult = await this.cfnService.describeChangeSet({ StackName: params.stackName, diff --git a/src/stacks/actions/DeploymentWorkflow.ts b/src/stacks/actions/DeploymentWorkflow.ts index a4f5a19f..3b716cbe 100644 --- a/src/stacks/actions/DeploymentWorkflow.ts +++ b/src/stacks/actions/DeploymentWorkflow.ts @@ -6,6 +6,7 @@ import { CfnExternal } from '../../server/CfnExternal'; import { CfnInfraCore } from '../../server/CfnInfraCore'; import { CfnService } from '../../services/CfnService'; import { LoggerFactory } from '../../telemetry/LoggerFactory'; +import { Measure } from '../../telemetry/TelemetryDecorator'; import { extractErrorMessage } from '../../utils/Errors'; import { waitForDeployment, @@ -33,6 +34,7 @@ export class DeploymentWorkflow implements StackActionWorkflow { const workflow = { id: params.id, diff --git a/src/stacks/actions/ValidationWorkflow.ts b/src/stacks/actions/ValidationWorkflow.ts index 3b68365e..44da4e47 100644 --- a/src/stacks/actions/ValidationWorkflow.ts +++ b/src/stacks/actions/ValidationWorkflow.ts @@ -10,6 +10,7 @@ import { CfnService } from '../../services/CfnService'; import { DiagnosticCoordinator } from '../../services/DiagnosticCoordinator'; import { S3Service } from '../../services/S3Service'; import { LoggerFactory } from '../../telemetry/LoggerFactory'; +import { Measure } from '../../telemetry/TelemetryDecorator'; import { extractErrorMessage } from '../../utils/Errors'; import { cleanupReviewStack, @@ -52,6 +53,7 @@ export class ValidationWorkflow implements StackActionWorkflow { // Determine ChangeSet type based on resourcesToImport and stack existence let changeSetType: ChangeSetType;