Skip to content

Commit 2f0576a

Browse files
authored
chore(doc): udpate documentation (#486)
* chore(doc): update documentation * chore(doc): update documentation
1 parent 136d369 commit 2f0576a

File tree

29 files changed

+20
-293
lines changed

29 files changed

+20
-293
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ The official samples repository https://github.com/aws-samples/generative-ai-cdk
119119

120120
# Operational Metrics Collection
121121

122-
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.
122+
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.
123123

124124
# Roadmap
125125

apidocs/interfaces/BaseClassProps.md

-20
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
- [constructId](BaseClassProps.md#constructid)
1010
- [constructName](BaseClassProps.md#constructname)
11-
- [enableOperationalMetric](BaseClassProps.md#enableoperationalmetric)
1211
- [observability](BaseClassProps.md#observability)
1312
- [stage](BaseClassProps.md#stage)
1413

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

3130
___
3231

33-
### enableOperationalMetric
34-
35-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
36-
37-
Optional.CDK constructs provided collects anonymous operational
38-
metrics to help AWS improve the quality and features of the
39-
constructs. Data collection is subject to the AWS Privacy Policy
40-
(https://aws.amazon.com/privacy/). To opt out of this feature,
41-
simply disable it by setting the construct property
42-
"enableOperationalMetric" to false for each construct used.
43-
44-
**`Default`**
45-
46-
```ts
47-
- true
48-
```
49-
50-
___
51-
5232
### observability
5333

5434
`Optional` `Readonly` **observability**: `boolean`

apidocs/interfaces/ContentGenerationAppSyncLambdaProps.md

-20
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ The properties for the ContentGenerationAppSyncLambdaProps class.
1010

1111
- [cognitoUserPool](ContentGenerationAppSyncLambdaProps.md#cognitouserpool)
1212
- [customDockerLambdaProps](ContentGenerationAppSyncLambdaProps.md#customdockerlambdaprops)
13-
- [enableOperationalMetric](ContentGenerationAppSyncLambdaProps.md#enableoperationalmetric)
1413
- [existingBusInterface](ContentGenerationAppSyncLambdaProps.md#existingbusinterface)
1514
- [existingGeneratedAssetsBucketObj](ContentGenerationAppSyncLambdaProps.md#existinggeneratedassetsbucketobj)
1615
- [existingMergedApi](ContentGenerationAppSyncLambdaProps.md#existingmergedapi)
@@ -47,25 +46,6 @@ and settings instead of the existing
4746

4847
___
4948

50-
### enableOperationalMetric
51-
52-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
53-
54-
Optional.CDK constructs provided collects anonymous operational
55-
metrics to help AWS improve the quality and features of the
56-
constructs. Data collection is subject to the AWS Privacy Policy
57-
(https://aws.amazon.com/privacy/). To opt out of this feature,
58-
simply disable it by setting the construct property
59-
"enableOperationalMetric" to false for each construct used.
60-
61-
**`Default`**
62-
63-
```ts
64-
- true
65-
```
66-
67-
___
68-
6949
### existingBusInterface
7050

7151
`Optional` `Readonly` **existingBusInterface**: `IEventBus`

apidocs/interfaces/CustomSageMakerEndpointProps.md

-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
### Properties
88

99
- [container](CustomSageMakerEndpointProps.md#container)
10-
- [enableOperationalMetric](CustomSageMakerEndpointProps.md#enableoperationalmetric)
1110
- [endpointName](CustomSageMakerEndpointProps.md#endpointname)
1211
- [environment](CustomSageMakerEndpointProps.md#environment)
1312
- [instanceCount](CustomSageMakerEndpointProps.md#instancecount)
@@ -28,12 +27,6 @@
2827

2928
___
3029

31-
### enableOperationalMetric
32-
33-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
34-
35-
___
36-
3730
### endpointName
3831

3932
`Readonly` **endpointName**: `string`

apidocs/interfaces/HuggingFaceSageMakerEndpointProps.md

-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
### Properties
88

99
- [container](HuggingFaceSageMakerEndpointProps.md#container)
10-
- [enableOperationalMetric](HuggingFaceSageMakerEndpointProps.md#enableoperationalmetric)
1110
- [endpointName](HuggingFaceSageMakerEndpointProps.md#endpointname)
1211
- [environment](HuggingFaceSageMakerEndpointProps.md#environment)
1312
- [instanceCount](HuggingFaceSageMakerEndpointProps.md#instancecount)
@@ -25,12 +24,6 @@
2524

2625
___
2726

28-
### enableOperationalMetric
29-
30-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
31-
32-
___
33-
3427
### endpointName
3528

3629
`Optional` `Readonly` **endpointName**: `string`

apidocs/interfaces/JumpStartSageMakerEndpointProps.md

-7
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
### Properties
88

99
- [acceptEula](JumpStartSageMakerEndpointProps.md#accepteula)
10-
- [enableOperationalMetric](JumpStartSageMakerEndpointProps.md#enableoperationalmetric)
1110
- [endpointName](JumpStartSageMakerEndpointProps.md#endpointname)
1211
- [environment](JumpStartSageMakerEndpointProps.md#environment)
1312
- [instanceCount](JumpStartSageMakerEndpointProps.md#instancecount)
@@ -25,12 +24,6 @@
2524

2625
___
2726

28-
### enableOperationalMetric
29-
30-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
31-
32-
___
33-
3427
### endpointName
3528

3629
`Readonly` **endpointName**: `string`

apidocs/interfaces/QaAppsyncOpensearchProps.md

-20
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ The properties for the QaAppsyncOpensearchProps class.
1111
- [bucketInputsAssetsProps](QaAppsyncOpensearchProps.md#bucketinputsassetsprops)
1212
- [cognitoUserPool](QaAppsyncOpensearchProps.md#cognitouserpool)
1313
- [customDockerLambdaProps](QaAppsyncOpensearchProps.md#customdockerlambdaprops)
14-
- [enableOperationalMetric](QaAppsyncOpensearchProps.md#enableoperationalmetric)
1514
- [existingBusInterface](QaAppsyncOpensearchProps.md#existingbusinterface)
1615
- [existingInputAssetsBucketObj](QaAppsyncOpensearchProps.md#existinginputassetsbucketobj)
1716
- [existingMergedApi](QaAppsyncOpensearchProps.md#existingmergedapi)
@@ -66,25 +65,6 @@ and settings instead of the existing
6665

6766
___
6867

69-
### enableOperationalMetric
70-
71-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
72-
73-
Optional.CDK constructs provided collects anonymous operational
74-
metrics to help AWS improve the quality and features of the
75-
constructs. Data collection is subject to the AWS Privacy Policy
76-
(https://aws.amazon.com/privacy/). To opt out of this feature,
77-
simply disable it by setting the construct property
78-
"enableOperationalMetric" to false for each construct used.
79-
80-
**`Default`**
81-
82-
```ts
83-
- true
84-
```
85-
86-
___
87-
8868
### existingBusInterface
8969

9070
`Optional` `Readonly` **existingBusInterface**: `IEventBus`

apidocs/interfaces/RagAppsyncStepfnOpensearchProps.md

-20
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ The properties for the RagAppsyncStepfnOpensearchProps class.
1414
- [customEmbeddingsDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#customembeddingsdockerlambdaprops)
1515
- [customFileTransformerDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#customfiletransformerdockerlambdaprops)
1616
- [customInputValidationDockerLambdaProps](RagAppsyncStepfnOpensearchProps.md#custominputvalidationdockerlambdaprops)
17-
- [enableOperationalMetric](RagAppsyncStepfnOpensearchProps.md#enableoperationalmetric)
1817
- [existingBusInterface](RagAppsyncStepfnOpensearchProps.md#existingbusinterface)
1918
- [existingInputAssetsBucketObj](RagAppsyncStepfnOpensearchProps.md#existinginputassetsbucketobj)
2019
- [existingMergedApi](RagAppsyncStepfnOpensearchProps.md#existingmergedapi)
@@ -102,25 +101,6 @@ and settings instead of the existing
102101

103102
___
104103

105-
### enableOperationalMetric
106-
107-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
108-
109-
Optional.CDK constructs provided collects anonymous operational
110-
metrics to help AWS improve the quality and features of the
111-
constructs. Data collection is subject to the AWS Privacy Policy
112-
(https://aws.amazon.com/privacy/). To opt out of this feature,
113-
simply disable it by setting the construct property
114-
"enableOperationalMetric" to false for each construct used.
115-
116-
**`Default`**
117-
118-
```ts
119-
- true
120-
```
121-
122-
___
123-
124104
### existingBusInterface
125105

126106
`Optional` `Readonly` **existingBusInterface**: `IEventBus`

apidocs/interfaces/SummarizationAppsyncStepfnProps.md

-20
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
- [customDocumentReaderDockerLambdaProps](SummarizationAppsyncStepfnProps.md#customdocumentreaderdockerlambdaprops)
1313
- [customInputValidationDockerLambdaProps](SummarizationAppsyncStepfnProps.md#custominputvalidationdockerlambdaprops)
1414
- [customSummaryGeneratorDockerLambdaProps](SummarizationAppsyncStepfnProps.md#customsummarygeneratordockerlambdaprops)
15-
- [enableOperationalMetric](SummarizationAppsyncStepfnProps.md#enableoperationalmetric)
1615
- [eventBusProps](SummarizationAppsyncStepfnProps.md#eventbusprops)
1716
- [existingBusInterface](SummarizationAppsyncStepfnProps.md#existingbusinterface)
1817
- [existingInputAssetsBucketObj](SummarizationAppsyncStepfnProps.md#existinginputassetsbucketobj)
@@ -100,25 +99,6 @@ and settings instead of the existing
10099

101100
___
102101

103-
### enableOperationalMetric
104-
105-
`Optional` `Readonly` **enableOperationalMetric**: `boolean`
106-
107-
Optional.CDK constructs provided collects anonymous operational
108-
metrics to help AWS improve the quality and features of the
109-
constructs. Data collection is subject to the AWS Privacy Policy
110-
(https://aws.amazon.com/privacy/). To opt out of this feature,
111-
simply disable it by setting the construct property
112-
"enableOperationalMetric" to false for each construct used.
113-
114-
**`Default`**
115-
116-
```ts
117-
- true
118-
```
119-
120-
___
121-
122102
### eventBusProps
123103

124104
`Optional` `Readonly` **eventBusProps**: `EventBusProps`

src/common/base-class/base-class.ts

+17-37
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,6 @@ export interface BaseClassProps {
2727
*/
2828
readonly stage?: string;
2929

30-
31-
/**
32-
* Optional.CDK constructs provided collects anonymous operational
33-
* metrics to help AWS improve the quality and features of the
34-
* constructs. Data collection is subject to the AWS Privacy Policy
35-
* (https://aws.amazon.com/privacy/). To opt out of this feature,
36-
* simply disable it by setting the construct property
37-
* "enableOperationalMetric" to false for each construct used.
38-
*
39-
* @default - true
40-
*/
41-
readonly enableOperationalMetric?: boolean;
42-
4330
/**
4431
* name of the construct.
4532
*
@@ -130,42 +117,35 @@ export class BaseClass extends Construct {
130117
}
131118

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

141-
const enableOperationalMetric =
142-
props.enableOperationalMetric !== undefined &&
143-
props.enableOperationalMetric !== null ? props.enableOperationalMetric : true;
144-
145-
if (enableOperationalMetric) {
146-
if (lambdaFunctions
147-
&& lambdaFunctions.length > 0) {
148-
for (let lambdaFunction of lambdaFunctions) {
149-
lambdaFunction.addEnvironment(
150-
'AWS_SDK_UA_APP_ID', solutionId,
151-
);
152-
}
127+
if (lambdaFunctions
128+
&& lambdaFunctions.length > 0) {
129+
for (let lambdaFunction of lambdaFunctions) {
130+
lambdaFunction.addEnvironment(
131+
'AWS_SDK_UA_APP_ID', solutionId,
132+
);
153133
}
134+
}
154135

155-
if (props && BaseClass.usageMetricMap.hasOwnProperty(props.constructName)) {
156-
BaseClass.usageMetricMap[props.constructName]=BaseClass.usageMetricMap[props.constructName]+1;
157-
} else {
158-
throw Error('construct name is not present in usageMetricMap ');
159-
}
136+
if (props && BaseClass.usageMetricMap.hasOwnProperty(props.constructName)) {
137+
BaseClass.usageMetricMap[props.constructName]=BaseClass.usageMetricMap[props.constructName]+1;
138+
} else {
139+
throw Error('construct name is not present in usageMetricMap ');
140+
}
160141

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

163-
// 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}) ",
164-
// where C1,C2, etc are mapped with construct-name-enum and the values shows the number of time stack created/deleted.
165-
Stack.of(scope).templateOptions.description =
166-
`Description: (${this.constructUsageMetric}) (version:${version}) (tag:${ usageMetricMapSerialized}) `;
144+
// 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}) ",
145+
// where C1,C2, etc are mapped with construct-name-enum and the values shows the number of time stack created/deleted.
146+
Stack.of(scope).templateOptions.description =
147+
`Description: (${this.constructUsageMetric}) (version:${version}) (tag:${ usageMetricMapSerialized}) `;
167148

168-
};
169149
}
170150

171151
// observability

src/patterns/gen-ai/aws-contentgen-appsync-lambda/README.md

-1
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,6 @@ Parameters
246246
| 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.|
247247
| 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.|
248248
| 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.|
249-
| 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.|
250249
| stage | string | ![Optional](https://img.shields.io/badge/optional-4169E1) | Value will be appended to resources name service. |
251250
| 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.|
252251

src/patterns/gen-ai/aws-contentgen-appsync-lambda/index.ts

-14
Original file line numberDiff line numberDiff line change
@@ -100,19 +100,6 @@ export interface ContentGenerationAppSyncLambdaProps {
100100
* @default - true
101101
*/
102102
readonly observability?: boolean;
103-
104-
/**
105-
* Optional.CDK constructs provided collects anonymous operational
106-
* metrics to help AWS improve the quality and features of the
107-
* constructs. Data collection is subject to the AWS Privacy Policy
108-
* (https://aws.amazon.com/privacy/). To opt out of this feature,
109-
* simply disable it by setting the construct property
110-
* "enableOperationalMetric" to false for each construct used.
111-
*
112-
* @default - true
113-
*/
114-
readonly enableOperationalMetric?: boolean;
115-
116103
/**
117104
* Optional. Allows a user to configure
118105
* Lambda provisioned concurrency for consistent performance
@@ -173,7 +160,6 @@ export class ContentGenerationAppSyncLambda extends BaseClass {
173160

174161
const baseProps: BaseClassProps={
175162
stage: props.stage,
176-
enableOperationalMetric: props.enableOperationalMetric,
177163
constructName: ConstructName.AWSCONTENTGENAPPSYNCLAMBDA,
178164
constructId: id,
179165
observability: props.observability,

src/patterns/gen-ai/aws-model-deployment-sagemaker/custom-sagemaker-endpoint.ts

-2
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ export interface CustomSageMakerEndpointProps {
3333
readonly volumeSizeInGb?: number | undefined;
3434
readonly vpcConfig?: sagemaker.CfnModel.VpcConfigProperty | undefined;
3535
readonly modelDataUrl: string;
36-
readonly enableOperationalMetric?: boolean;
3736

3837
}
3938

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

5958
const baseProps: BaseClassProps={
60-
enableOperationalMetric: props.enableOperationalMetric,
6159
constructName: ConstructName.CUSTOMSAGEMAKERENDPOINT,
6260
constructId: id,
6361
};

src/patterns/gen-ai/aws-model-deployment-sagemaker/huggingface-sagemaker-endpoint.ts

-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export interface HuggingFaceSageMakerEndpointProps {
3030
readonly environment?: { [key: string]: string };
3131
readonly startupHealthCheckTimeoutInSeconds?: number;
3232
readonly vpcConfig?: sagemaker.CfnModel.VpcConfigProperty | undefined;
33-
readonly enableOperationalMetric?: boolean;
3433
}
3534

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

5756
const baseProps: BaseClassProps={
58-
enableOperationalMetric: props.enableOperationalMetric,
5957
constructName: ConstructName.HUGGINGFACESAGEMAKERENDPOINT,
6058
constructId: id,
6159
};

0 commit comments

Comments
 (0)