Skip to content

Commit ac3c4c9

Browse files
authored
Merge branch 'main' into merge-back/2.209.1
2 parents e7e3460 + df1c4cb commit ac3c4c9

19 files changed

+32690
-24
lines changed

packages/@aws-cdk/aws-bedrock-alpha/bedrock/inference-profiles/application-inference-profile.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import { Arn, ArnFormat, ValidationError } from 'aws-cdk-lib';
22
import * as bedrock from 'aws-cdk-lib/aws-bedrock';
33
import { Grant, IGrantable } from 'aws-cdk-lib/aws-iam';
4-
import { addConstructMetadata, MethodMetadata } from 'aws-cdk-lib/core/lib/metadata-resource';
5-
import { propertyInjectable } from 'aws-cdk-lib/core/lib/prop-injectable';
64
import { Construct } from 'constructs';
75
import { IInferenceProfile, InferenceProfileBase, InferenceProfileType } from './inference-profile';
86
import { IBedrockInvokable } from '../models';
@@ -94,11 +92,7 @@ export interface ApplicationInferenceProfileAttributes {
9492
* @cloudformationResource AWS::Bedrock::ApplicationInferenceProfile
9593
* @see https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-create.html
9694
*/
97-
@propertyInjectable
9895
export class ApplicationInferenceProfile extends InferenceProfileBase implements IBedrockInvokable {
99-
/** Uniquely identifies this class. */
100-
public static readonly PROPERTY_INJECTION_ID: string = '@aws-cdk.aws-bedrock-alpha.ApplicationInferenceProfile';
101-
10296
/**
10397
* Import an Application Inference Profile given its attributes.
10498
*
@@ -231,8 +225,6 @@ export class ApplicationInferenceProfile extends InferenceProfileBase implements
231225
// ------------------------------------------------------
232226
constructor(scope: Construct, id: string, props: ApplicationInferenceProfileProps) {
233227
super(scope, id);
234-
// Enhanced CDK Analytics Telemetry
235-
addConstructMetadata(this, props);
236228

237229
// ------------------------------------------------------
238230
// Validate props
@@ -329,7 +321,6 @@ export class ApplicationInferenceProfile extends InferenceProfileBase implements
329321
* @param grantee - The IAM principal to grant permissions to
330322
* @returns An IAM Grant object representing the granted permissions
331323
*/
332-
@MethodMetadata()
333324
public grantInvoke(grantee: IGrantable): Grant {
334325
// This method ensures the appropriate permissions are given
335326
// to use either the inference profile or the vanilla foundation model
@@ -351,7 +342,6 @@ export class ApplicationInferenceProfile extends InferenceProfileBase implements
351342
* @param grantee - The IAM principal to grant permissions to
352343
* @returns An IAM Grant object representing the granted permissions
353344
*/
354-
@MethodMetadata()
355345
public grantProfileUsage(grantee: IGrantable): Grant {
356346
return Grant.addToPrincipal({
357347
grantee: grantee,

packages/@aws-cdk/aws-glue-alpha/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,36 @@ new glue.RayJob(stack, 'ImportedJob', {
343343
});
344344
```
345345

346+
### Metrics Control
347+
348+
By default, Glue jobs enable CloudWatch metrics (`--enable-metrics`) and observability metrics (`--enable-observability-metrics`) for monitoring and debugging. You can disable these metrics to reduce CloudWatch costs:
349+
350+
```ts
351+
import * as cdk from 'aws-cdk-lib';
352+
import * as iam from 'aws-cdk-lib/aws-iam';
353+
declare const stack: cdk.Stack;
354+
declare const role: iam.IRole;
355+
declare const script: glue.Code;
356+
357+
// Disable both metrics for cost optimization
358+
new glue.PySparkEtlJob(stack, 'CostOptimizedJob', {
359+
role,
360+
script,
361+
enableMetrics: false,
362+
enableObservabilityMetrics: false,
363+
});
364+
365+
// Selective control - keep observability, disable profiling
366+
new glue.PySparkEtlJob(stack, 'SelectiveJob', {
367+
role,
368+
script,
369+
enableMetrics: false,
370+
// enableObservabilityMetrics defaults to true
371+
});
372+
```
373+
374+
This feature is available for all Spark job types (ETL, Streaming, Flex) and Ray jobs.
375+
346376
### Enable Job Run Queuing
347377

348378
AWS Glue job queuing monitors your account level quotas and limits. If quotas or limits are insufficient to start a Glue job run, AWS Glue will automatically queue the job and wait for limits to free up. Once limits become available, AWS Glue will retry the job run. Glue jobs will queue for limits like max concurrent job runs per account, max concurrent Data Processing Units (DPU), and resource unavailable due to IP address exhaustion in Amazon Virtual Private Cloud (Amazon VPC).

packages/@aws-cdk/aws-glue-alpha/lib/jobs/ray-job.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,24 @@ export interface RayJobProps extends JobProps {
2929
* @default - no job run queuing
3030
*/
3131
readonly jobRunQueuingEnabled?: boolean;
32+
33+
/**
34+
* Enable profiling metrics for the Glue job.
35+
*
36+
* When enabled, adds '--enable-metrics' to job arguments.
37+
*
38+
* @default true
39+
*/
40+
readonly enableMetrics?: boolean;
41+
42+
/**
43+
* Enable observability metrics for the Glue job.
44+
*
45+
* When enabled, adds '--enable-observability-metrics': 'true' to job arguments.
46+
*
47+
* @default true
48+
*/
49+
readonly enableObservabilityMetrics?: boolean;
3250
}
3351

3452
/**
@@ -66,8 +84,10 @@ export class RayJob extends Job {
6684

6785
// Enable CloudWatch metrics and continuous logging by default as a best practice
6886
const continuousLoggingArgs = this.setupContinuousLogging(this.role, props.continuousLogging);
69-
const profilingMetricsArgs = { '--enable-metrics': '' };
70-
const observabilityMetricsArgs = { '--enable-observability-metrics': 'true' };
87+
88+
// Conditionally include metrics arguments (default to enabled for backward compatibility)
89+
const profilingMetricsArgs = (props.enableMetrics ?? true) ? { '--enable-metrics': '' } : {};
90+
const observabilityMetricsArgs = (props.enableObservabilityMetrics ?? true) ? { '--enable-observability-metrics': 'true' } : {};
7191

7292
// Combine command line arguments into a single line item
7393
const defaultArguments = {

packages/@aws-cdk/aws-glue-alpha/lib/jobs/spark-job.ts

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,24 @@ export interface SparkJobProps extends JobProps {
101101
* @see https://docs.aws.amazon.com/glue/latest/dg/aws-glue-programming-etl-glue-arguments.html
102102
*/
103103
readonly sparkUI?: SparkUIProps;
104+
105+
/**
106+
* Enable profiling metrics for the Glue job.
107+
*
108+
* When enabled, adds '--enable-metrics' to job arguments.
109+
*
110+
* @default true
111+
*/
112+
readonly enableMetrics?: boolean;
113+
114+
/**
115+
* Enable observability metrics for the Glue job.
116+
*
117+
* When enabled, adds '--enable-observability-metrics': 'true' to job arguments.
118+
*
119+
* @default true
120+
*/
121+
readonly enableObservabilityMetrics?: boolean;
104122
}
105123

106124
/**
@@ -134,8 +152,10 @@ export abstract class SparkJob extends Job {
134152
protected nonExecutableCommonArguments(props: SparkJobProps): {[key: string]: string} {
135153
// Enable CloudWatch metrics and continuous logging by default as a best practice
136154
const continuousLoggingArgs = this.setupContinuousLogging(this.role, props.continuousLogging);
137-
const profilingMetricsArgs = { '--enable-metrics': '' };
138-
const observabilityMetricsArgs = { '--enable-observability-metrics': 'true' };
155+
156+
// Conditionally include metrics arguments (default to enabled for backward compatibility)
157+
const profilingMetricsArgs = (props.enableMetrics ?? true) ? { '--enable-metrics': '' } : {};
158+
const observabilityMetricsArgs = (props.enableObservabilityMetrics ?? true) ? { '--enable-observability-metrics': 'true' } : {};
139159

140160
// Set spark ui args, if spark ui logging had been setup
141161
const sparkUIArgs = this.sparkUILoggingLocation ? ({

packages/@aws-cdk/aws-glue-alpha/test/integ.job-metrics-disabled.js.snapshot/asset.432033e3218068a915d2532fa9be7858a12b228a2ae6e5c10faccd9097b1e855.py

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)