Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add aggregate metrics for ddb source export and stream #3724

Merged
merged 2 commits into from
Nov 30, 2023

Conversation

graytaylor0
Copy link
Member

@graytaylor0 graytaylor0 commented Nov 29, 2023

Description

This change adds the following aggregate metrics (metrics without a sub-pipeline prefix) to dynamoDB source pipelines

  • stream5xxErrors - The number of errors encountered when calling stream APIs (getRecords, getShardIterator)

  • streamApiInvocations - The number of invocations of stream APIs

  • export5xxErrors - The number of errors encountered when calling export APIs (exportTableToPointInTime, describeExport)

  • exportApiInvocations - The number of invocations of export APIs

Check List

  • New functionality includes testing.
  • New functionality has a documentation issue. Please link to it in this PR.
    • New functionality has javadoc added
  • Commits are signed with a real name per the DCO

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

DescribeExportResponse resp = dynamoDBClient.describeExport(request);
manifestKey = resp.exportDescription().exportManifest();

} catch (final InternalServerErrorException e) {
dynamoAggregateMetrics.getExport5xxErrors().increment();
LOG.error("Unable to get manifest file for export " + exportArn);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we log the error here too? Same applies for the catch section below

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yeah we should log that

} catch(final InternalServerErrorException e) {
LOG.error("Received an internal server exception from DynamoDB while listing shards: {}", e.getMessage());
dynamoDBSourceAggregateMetrics.getStream5xxErrors().increment();
return shards;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rethrow the error here instead of potentially returning partial shards?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's anything wrong with returning partial shards, it just means we will only check those shards for child shards. The next time we run describeStream we will still go through the same shards again and create child shards for them (even the ones we return here) until 24 hours is up (when the shard would expire).

Signed-off-by: Taylor Gray <[email protected]>
ExportTableToPointInTimeResponse response = dynamoDBClient.exportTableToPointInTime(req);

String exportArn = response.exportDescription().exportArn();
String status = response.exportDescription().exportStatusAsString();
LOG.debug("Export Job submitted with ARN {} and status {}", exportArn, status);
return exportArn;
} catch (final InternalServerErrorException e) {
dynamoAggregateMetrics.getExport5xxErrors().increment();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we also consider adding pipeline specific metric ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there's any value in that for these metrics at least. There may be other pipeline specific metrics we can add, but that can be a future PR

@graytaylor0 graytaylor0 merged commit 1af1ce9 into opensearch-project:main Nov 30, 2023
38 of 47 checks passed
@graytaylor0 graytaylor0 deleted the DdbAggregateMetrics branch November 30, 2023 16:02
opensearch-trigger-bot bot pushed a commit that referenced this pull request Nov 30, 2023
Signed-off-by: Taylor Gray <[email protected]>
(cherry picked from commit 1af1ce9)
graytaylor0 added a commit that referenced this pull request Dec 1, 2023
Signed-off-by: Taylor Gray <[email protected]>
(cherry picked from commit 1af1ce9)

Co-authored-by: Taylor Gray <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants