Skip to content

Commit

Permalink
use SparqlRequestsPerSec metric instead of deprecated SparqlErrors
Browse files Browse the repository at this point in the history
  • Loading branch information
humanzz committed Sep 21, 2022
1 parent ae08f15 commit bf1a6a1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-neptune/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ Both `DatabaseCluster` and `DatabaseInstance` provide a `metric()` method to hel
declare const cluster: neptune.DatabaseCluster;
declare const instance: neptune.DatabaseInstance;

cluster.metric('SparqlErrors'); // cluster-level SparqlErrors metric
instance.metric('SparqlErrors') // instance-level SparqlErrors metric
cluster.metric('SparqlRequestsPerSec'); // cluster-level SparqlErrors metric
instance.metric('SparqlRequestsPerSec') // instance-level SparqlErrors metric
```

For more details on the available metrics, refer to https://docs.aws.amazon.com/neptune/latest/userguide/cw-metrics.html
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@
"Alarm7103F465": {
"Type": "AWS::CloudWatch::Alarm",
"Properties": {
"ComparisonOperator": "GreaterThanThreshold",
"ComparisonOperator": "LessThanThreshold",
"EvaluationPeriods": 1,
"Dimensions": [
{
Expand All @@ -552,11 +552,11 @@
}
}
],
"MetricName": "SparqlErrors",
"MetricName": "SparqlRequestsPerSec",
"Namespace": "AWS/Neptune",
"Period": 300,
"Statistic": "Sum",
"Threshold": 0
"Statistic": "Average",
"Threshold": 1
}
}
},
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-neptune/test/cluster.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -671,11 +671,11 @@ describe('DatabaseCluster', () => {
});

// WHEN
const metric = cluster.metric('SparqlErrors');
const metric = cluster.metric('SparqlRequestsPerSec');
new cloudwatch.Alarm(stack, 'Alarm', {
evaluationPeriods: 1,
threshold: 0,
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 1,
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,
metric: metric,
});

Expand All @@ -685,20 +685,20 @@ describe('DatabaseCluster', () => {
dimensionsMap: {
DBClusterIdentifier: cluster.clusterIdentifier,
},
metricName: 'SparqlErrors',
metricName: 'SparqlRequestsPerSec',
}));
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
Namespace: 'AWS/Neptune',
MetricName: 'SparqlErrors',
MetricName: 'SparqlRequestsPerSec',
Dimensions: [
{
Name: 'DBClusterIdentifier',
Value: stack.resolve(cluster.clusterIdentifier),
},
],
ComparisonOperator: 'GreaterThanThreshold',
ComparisonOperator: 'LessThanThreshold',
EvaluationPeriods: 1,
Threshold: 0,
Threshold: 1,
});
});
});
Expand Down
14 changes: 7 additions & 7 deletions packages/@aws-cdk/aws-neptune/test/instance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,11 @@ describe('DatabaseInstance', () => {
});

// WHEN
const metric = instance.metric('SparqlErrors');
const metric = instance.metric('SparqlRequestsPerSec');
new cloudwatch.Alarm(stack, 'Alarm', {
evaluationPeriods: 1,
threshold: 0,
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 1,
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,
metric: metric,
});

Expand All @@ -165,20 +165,20 @@ describe('DatabaseInstance', () => {
dimensionsMap: {
DBInstanceIdentifier: instance.instanceIdentifier,
},
metricName: 'SparqlErrors',
metricName: 'SparqlRequestsPerSec',
}));
Template.fromStack(stack).hasResourceProperties('AWS::CloudWatch::Alarm', {
Namespace: 'AWS/Neptune',
MetricName: 'SparqlErrors',
MetricName: 'SparqlRequestsPerSec',
Dimensions: [
{
Name: 'DBInstanceIdentifier',
Value: stack.resolve(instance.instanceIdentifier),
},
],
ComparisonOperator: 'GreaterThanThreshold',
ComparisonOperator: 'LessThanThreshold',
EvaluationPeriods: 1,
Threshold: 0,
Threshold: 1,
});
});
});
Expand Down
6 changes: 3 additions & 3 deletions packages/@aws-cdk/aws-neptune/test/integ.cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ const cluster = new DatabaseCluster(stack, 'Database', {

cluster.connections.allowDefaultPortFromAnyIpv4('Open to the world');

const metric = cluster.metric('SparqlErrors', { statistic: cloudwatch.Statistic.SUM });
const metric = cluster.metric('SparqlRequestsPerSec');
new cloudwatch.Alarm(stack, 'Alarm', {
evaluationPeriods: 1,
threshold: 0,
comparisonOperator: cloudwatch.ComparisonOperator.GREATER_THAN_THRESHOLD,
threshold: 1,
comparisonOperator: cloudwatch.ComparisonOperator.LESS_THAN_THRESHOLD,
metric: metric,
});

Expand Down

0 comments on commit bf1a6a1

Please sign in to comment.