Skip to content

Commit

Permalink
chore(doc): udpate documentation (#486)
Browse files Browse the repository at this point in the history
* chore(doc): update documentation

* chore(doc): update documentation
  • Loading branch information
krokoko authored Jun 1, 2024
1 parent 136d369 commit 2f0576a
Show file tree
Hide file tree
Showing 29 changed files with 20 additions and 293 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ The official samples repository https://github.com/aws-samples/generative-ai-cdk

# Operational Metrics Collection

Provided CDK constructs collect anonymous operational metrics to help AWS improve the quality and features of the constructs. Data collection is subject to the AWS Privacy Policy (https://aws.amazon.com/privacy/). To opt out of this feature, simply disable it by setting the construct property "enableOperationalMetric" to false for each construct used. Defaults to true.
Generative AI CDK Constructs may collect anonymous operational metrics, including: the region a construct is deployed, the name and version of the construct deployed, and related information. We may use the metrics to maintain, provide, develop, and improve the constructs and AWS services.

# Roadmap

Expand Down
20 changes: 0 additions & 20 deletions apidocs/interfaces/BaseClassProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@

- [constructId](BaseClassProps.md#constructid)
- [constructName](BaseClassProps.md#constructname)
- [enableOperationalMetric](BaseClassProps.md#enableoperationalmetric)
- [observability](BaseClassProps.md#observability)
- [stage](BaseClassProps.md#stage)

Expand All @@ -30,25 +29,6 @@ name of the construct.

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

Optional.CDK constructs provided collects anonymous operational
metrics to help AWS improve the quality and features of the
constructs. Data collection is subject to the AWS Privacy Policy
(https://aws.amazon.com/privacy/). To opt out of this feature,
simply disable it by setting the construct property
"enableOperationalMetric" to false for each construct used.

**`Default`**

```ts
- true
```

___

### observability

`Optional` `Readonly` **observability**: `boolean`
Expand Down
20 changes: 0 additions & 20 deletions apidocs/interfaces/ContentGenerationAppSyncLambdaProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ The properties for the ContentGenerationAppSyncLambdaProps class.

- [cognitoUserPool](ContentGenerationAppSyncLambdaProps.md#cognitouserpool)
- [customDockerLambdaProps](ContentGenerationAppSyncLambdaProps.md#customdockerlambdaprops)
- [enableOperationalMetric](ContentGenerationAppSyncLambdaProps.md#enableoperationalmetric)
- [existingBusInterface](ContentGenerationAppSyncLambdaProps.md#existingbusinterface)
- [existingGeneratedAssetsBucketObj](ContentGenerationAppSyncLambdaProps.md#existinggeneratedassetsbucketobj)
- [existingMergedApi](ContentGenerationAppSyncLambdaProps.md#existingmergedapi)
Expand Down Expand Up @@ -47,25 +46,6 @@ and settings instead of the existing

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

Optional.CDK constructs provided collects anonymous operational
metrics to help AWS improve the quality and features of the
constructs. Data collection is subject to the AWS Privacy Policy
(https://aws.amazon.com/privacy/). To opt out of this feature,
simply disable it by setting the construct property
"enableOperationalMetric" to false for each construct used.

**`Default`**

```ts
- true
```

___

### existingBusInterface

`Optional` `Readonly` **existingBusInterface**: `IEventBus`
Expand Down
7 changes: 0 additions & 7 deletions apidocs/interfaces/CustomSageMakerEndpointProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
### Properties

- [container](CustomSageMakerEndpointProps.md#container)
- [enableOperationalMetric](CustomSageMakerEndpointProps.md#enableoperationalmetric)
- [endpointName](CustomSageMakerEndpointProps.md#endpointname)
- [environment](CustomSageMakerEndpointProps.md#environment)
- [instanceCount](CustomSageMakerEndpointProps.md#instancecount)
Expand All @@ -28,12 +27,6 @@

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

___

### endpointName

`Readonly` **endpointName**: `string`
Expand Down
7 changes: 0 additions & 7 deletions apidocs/interfaces/HuggingFaceSageMakerEndpointProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
### Properties

- [container](HuggingFaceSageMakerEndpointProps.md#container)
- [enableOperationalMetric](HuggingFaceSageMakerEndpointProps.md#enableoperationalmetric)
- [endpointName](HuggingFaceSageMakerEndpointProps.md#endpointname)
- [environment](HuggingFaceSageMakerEndpointProps.md#environment)
- [instanceCount](HuggingFaceSageMakerEndpointProps.md#instancecount)
Expand All @@ -25,12 +24,6 @@

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

___

### endpointName

`Optional` `Readonly` **endpointName**: `string`
Expand Down
7 changes: 0 additions & 7 deletions apidocs/interfaces/JumpStartSageMakerEndpointProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
### Properties

- [acceptEula](JumpStartSageMakerEndpointProps.md#accepteula)
- [enableOperationalMetric](JumpStartSageMakerEndpointProps.md#enableoperationalmetric)
- [endpointName](JumpStartSageMakerEndpointProps.md#endpointname)
- [environment](JumpStartSageMakerEndpointProps.md#environment)
- [instanceCount](JumpStartSageMakerEndpointProps.md#instancecount)
Expand All @@ -25,12 +24,6 @@

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

___

### endpointName

`Readonly` **endpointName**: `string`
Expand Down
20 changes: 0 additions & 20 deletions apidocs/interfaces/QaAppsyncOpensearchProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ The properties for the QaAppsyncOpensearchProps class.
- [bucketInputsAssetsProps](QaAppsyncOpensearchProps.md#bucketinputsassetsprops)
- [cognitoUserPool](QaAppsyncOpensearchProps.md#cognitouserpool)
- [customDockerLambdaProps](QaAppsyncOpensearchProps.md#customdockerlambdaprops)
- [enableOperationalMetric](QaAppsyncOpensearchProps.md#enableoperationalmetric)
- [existingBusInterface](QaAppsyncOpensearchProps.md#existingbusinterface)
- [existingInputAssetsBucketObj](QaAppsyncOpensearchProps.md#existinginputassetsbucketobj)
- [existingMergedApi](QaAppsyncOpensearchProps.md#existingmergedapi)
Expand Down Expand Up @@ -66,25 +65,6 @@ and settings instead of the existing

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

Optional.CDK constructs provided collects anonymous operational
metrics to help AWS improve the quality and features of the
constructs. Data collection is subject to the AWS Privacy Policy
(https://aws.amazon.com/privacy/). To opt out of this feature,
simply disable it by setting the construct property
"enableOperationalMetric" to false for each construct used.

**`Default`**

```ts
- true
```

___

### existingBusInterface

`Optional` `Readonly` **existingBusInterface**: `IEventBus`
Expand Down
20 changes: 0 additions & 20 deletions apidocs/interfaces/RagAppsyncStepfnOpensearchProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ The properties for the RagAppsyncStepfnOpensearchProps class.
- [customEmbeddingsDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#customembeddingsdockerlambdaprops)
- [customFileTransformerDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#customfiletransformerdockerlambdaprops)
- [customInputValidationDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#custominputvalidationdockerlambdaprops)
- [enableOperationalMetric](RagAppsyncStepfnOpensearchProps.md#enableoperationalmetric)
- [existingBusInterface](RagAppsyncStepfnOpensearchProps.md#existingbusinterface)
- [existingInputAssetsBucketObj](RagAppsyncStepfnOpensearchProps.md#existinginputassetsbucketobj)
- [existingMergedApi](RagAppsyncStepfnOpensearchProps.md#existingmergedapi)
Expand Down Expand Up @@ -102,25 +101,6 @@ and settings instead of the existing

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

Optional.CDK constructs provided collects anonymous operational
metrics to help AWS improve the quality and features of the
constructs. Data collection is subject to the AWS Privacy Policy
(https://aws.amazon.com/privacy/). To opt out of this feature,
simply disable it by setting the construct property
"enableOperationalMetric" to false for each construct used.

**`Default`**

```ts
- true
```

___

### existingBusInterface

`Optional` `Readonly` **existingBusInterface**: `IEventBus`
Expand Down
20 changes: 0 additions & 20 deletions apidocs/interfaces/SummarizationAppsyncStepfnProps.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
- [customDocumentReaderDockerLambdaProps](SummarizationAppsyncStepfnProps.md#customdocumentreaderdockerlambdaprops)
- [customInputValidationDockerLambdaProps](SummarizationAppsyncStepfnProps.md#custominputvalidationdockerlambdaprops)
- [customSummaryGeneratorDockerLambdaProps](SummarizationAppsyncStepfnProps.md#customsummarygeneratordockerlambdaprops)
- [enableOperationalMetric](SummarizationAppsyncStepfnProps.md#enableoperationalmetric)
- [eventBusProps](SummarizationAppsyncStepfnProps.md#eventbusprops)
- [existingBusInterface](SummarizationAppsyncStepfnProps.md#existingbusinterface)
- [existingInputAssetsBucketObj](SummarizationAppsyncStepfnProps.md#existinginputassetsbucketobj)
Expand Down Expand Up @@ -100,25 +99,6 @@ and settings instead of the existing

___

### enableOperationalMetric

`Optional` `Readonly` **enableOperationalMetric**: `boolean`

Optional.CDK constructs provided collects anonymous operational
metrics to help AWS improve the quality and features of the
constructs. Data collection is subject to the AWS Privacy Policy
(https://aws.amazon.com/privacy/). To opt out of this feature,
simply disable it by setting the construct property
"enableOperationalMetric" to false for each construct used.

**`Default`**

```ts
- true
```

___

### eventBusProps

`Optional` `Readonly` **eventBusProps**: `EventBusProps`
Expand Down
54 changes: 17 additions & 37 deletions src/common/base-class/base-class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,6 @@ export interface BaseClassProps {
*/
readonly stage?: string;


/**
* Optional.CDK constructs provided collects anonymous operational
* metrics to help AWS improve the quality and features of the
* constructs. Data collection is subject to the AWS Privacy Policy
* (https://aws.amazon.com/privacy/). To opt out of this feature,
* simply disable it by setting the construct property
* "enableOperationalMetric" to false for each construct used.
*
* @default - true
*/
readonly enableOperationalMetric?: boolean;

/**
* name of the construct.
*
Expand Down Expand Up @@ -130,42 +117,35 @@ export class BaseClass extends Construct {
}

/*
* If enableOperationalMetric is set to true,
* update template description with construct usage metric and
* add AWS_SDK_UA_APP_ID to user agent on aws sdk.
*/
protected updateConstructUsageMetricCode(props: BaseClassProps, scope: Construct, lambdaFunctions: lambda.DockerImageFunction[],
) {
const solutionId = `genai_cdk_${version}/${props.constructName}/${props.constructId}`;

const enableOperationalMetric =
props.enableOperationalMetric !== undefined &&
props.enableOperationalMetric !== null ? props.enableOperationalMetric : true;

if (enableOperationalMetric) {
if (lambdaFunctions
&& lambdaFunctions.length > 0) {
for (let lambdaFunction of lambdaFunctions) {
lambdaFunction.addEnvironment(
'AWS_SDK_UA_APP_ID', solutionId,
);
}
if (lambdaFunctions
&& lambdaFunctions.length > 0) {
for (let lambdaFunction of lambdaFunctions) {
lambdaFunction.addEnvironment(
'AWS_SDK_UA_APP_ID', solutionId,
);
}
}

if (props && BaseClass.usageMetricMap.hasOwnProperty(props.constructName)) {
BaseClass.usageMetricMap[props.constructName]=BaseClass.usageMetricMap[props.constructName]+1;
} else {
throw Error('construct name is not present in usageMetricMap ');
}
if (props && BaseClass.usageMetricMap.hasOwnProperty(props.constructName)) {
BaseClass.usageMetricMap[props.constructName]=BaseClass.usageMetricMap[props.constructName]+1;
} else {
throw Error('construct name is not present in usageMetricMap ');
}

const usageMetricMapSerialized = JSON.stringify(BaseClass.usageMetricMap).replace(/[{}]/g, '').replace(/"/g, '');
const usageMetricMapSerialized = JSON.stringify(BaseClass.usageMetricMap).replace(/[{}]/g, '').replace(/"/g, '');

// Description format :(usage id :uksb-1tupboc45)(version:0.0.0) (constructs :::{\"C1\":1,\"C2\":5,\"C3\":3,\"C4\":0,\"C5\":0,\"C6\":0,\"C7\":0,\"C8\":0}) ",
// where C1,C2, etc are mapped with construct-name-enum and the values shows the number of time stack created/deleted.
Stack.of(scope).templateOptions.description =
`Description: (${this.constructUsageMetric}) (version:${version}) (tag:${ usageMetricMapSerialized}) `;
// Description format :(usage id :uksb-1tupboc45)(version:0.0.0) (constructs :::{\"C1\":1,\"C2\":5,\"C3\":3,\"C4\":0,\"C5\":0,\"C6\":0,\"C7\":0,\"C8\":0}) ",
// where C1,C2, etc are mapped with construct-name-enum and the values shows the number of time stack created/deleted.
Stack.of(scope).templateOptions.description =
`Description: (${this.constructUsageMetric}) (version:${version}) (tag:${ usageMetricMapSerialized}) `;

};
}

// observability
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,6 @@ Parameters
| eventBusProps | [events.EventBusProps](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_events.EventBusProps.html) | ![Optional](https://img.shields.io/badge/optional-4169E1) | A new custom event bus is created with provided props. Providing both ```existingBusInterface``` and ```eventBusProps``` will result in an error.|
| existingMergedApi | [appsync.CfnGraphQLApi](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_appsync.CfnGraphQLApi.html) | ![Optional](https://img.shields.io/badge/optional-4169E1) | Existing Merged API instance. The Merged API provides a federated schema over source API schemas.|
| observability | boolean | ![Optional](https://img.shields.io/badge/optional-4169E1) | Enables observability on all services used. Warning: associated costs with the services used. It is a best practice to enable by default. Defaults to true.|
| enableOperationalMetric | boolean | ![Optional](https://img.shields.io/badge/optional-4169E1) | CDK construct collect anonymous operational metrics to help AWS improve the quality and features of the constructs. Data collection is subject to the AWS Privacy Policy (https://aws.amazon.com/privacy/). To opt out of this feature, simply disable it by setting the construct property "enableOperationalMetric" to false for each construct used. Defaults to true.|
| stage | string | ![Optional](https://img.shields.io/badge/optional-4169E1) | Value will be appended to resources name service. |
| customDockerLambdaProps | [DockerLambdaCustomProps](../../../common/props/DockerLambdaCustomProps.ts) | ![Optional](https://img.shields.io/badge/optional-4169E1) | Allows to provide question answering custom lambda code and settings instead of the default construct implementation.|

Expand Down
14 changes: 0 additions & 14 deletions src/patterns/gen-ai/aws-contentgen-appsync-lambda/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,6 @@ export interface ContentGenerationAppSyncLambdaProps {
* @default - true
*/
readonly observability?: boolean;

/**
* Optional.CDK constructs provided collects anonymous operational
* metrics to help AWS improve the quality and features of the
* constructs. Data collection is subject to the AWS Privacy Policy
* (https://aws.amazon.com/privacy/). To opt out of this feature,
* simply disable it by setting the construct property
* "enableOperationalMetric" to false for each construct used.
*
* @default - true
*/
readonly enableOperationalMetric?: boolean;

/**
* Optional. Allows a user to configure
* Lambda provisioned concurrency for consistent performance
Expand Down Expand Up @@ -173,7 +160,6 @@ export class ContentGenerationAppSyncLambda extends BaseClass {

const baseProps: BaseClassProps={
stage: props.stage,
enableOperationalMetric: props.enableOperationalMetric,
constructName: ConstructName.AWSCONTENTGENAPPSYNCLAMBDA,
constructId: id,
observability: props.observability,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export interface CustomSageMakerEndpointProps {
readonly volumeSizeInGb?: number | undefined;
readonly vpcConfig?: sagemaker.CfnModel.VpcConfigProperty | undefined;
readonly modelDataUrl: string;
readonly enableOperationalMetric?: boolean;

}

Expand All @@ -57,7 +56,6 @@ export class CustomSageMakerEndpoint extends SageMakerEndpointBase implements ia
super(scope, id);

const baseProps: BaseClassProps={
enableOperationalMetric: props.enableOperationalMetric,
constructName: ConstructName.CUSTOMSAGEMAKERENDPOINT,
constructId: id,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface HuggingFaceSageMakerEndpointProps {
readonly environment?: { [key: string]: string };
readonly startupHealthCheckTimeoutInSeconds?: number;
readonly vpcConfig?: sagemaker.CfnModel.VpcConfigProperty | undefined;
readonly enableOperationalMetric?: boolean;
}

/**
Expand All @@ -55,7 +54,6 @@ export class HuggingFaceSageMakerEndpoint extends SageMakerEndpointBase implemen
super(scope, id);

const baseProps: BaseClassProps={
enableOperationalMetric: props.enableOperationalMetric,
constructName: ConstructName.HUGGINGFACESAGEMAKERENDPOINT,
constructId: id,
};
Expand Down
Loading

0 comments on commit 2f0576a

Please sign in to comment.