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

Added workflow to index events from s3 data lake to metrics cluster #89

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

bshien
Copy link
Collaborator

@bshien bshien commented Oct 17, 2024

Description

Added lambda to index events from s3 data lake to metrics cluster

Issues Resolved

Part of #76

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.

Copy link

codecov bot commented Oct 17, 2024

Codecov Report

Attention: Patch coverage is 93.47826% with 9 lines in your changes missing coverage. Please review.

Project coverage is 84.52%. Comparing base (740daba) to head (c6b32d5).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...ava/org/opensearchmetrics/dagger/CommonModule.java 0.00% 5 Missing ⚠️
...g/opensearchmetrics/lambda/GithubEventsLambda.java 93.18% 2 Missing and 1 partial ⚠️
...a/org/opensearchmetrics/model/event/EventData.java 95.23% 1 Missing ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##               main      #89      +/-   ##
============================================
+ Coverage     83.57%   84.52%   +0.94%     
- Complexity      202      228      +26     
============================================
  Files            56       61       +5     
  Lines          1236     1370     +134     
  Branches         51       57       +6     
============================================
+ Hits           1033     1158     +125     
- Misses          181      189       +8     
- Partials         22       23       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bshien bshien force-pushed the events-index-lambda branch 2 times, most recently from c4ed1f5 to ace97ba Compare October 18, 2024 19:48
@Slf4j
public class GithubEventsLambda extends AbstractBaseLambda {
private final String[] eventsToIndex = {"issues.opened",
"issues.closed",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add them as enums.

});

// Create OpenSearch Metrics Lambda setup
const openSearchMetricsWorkflowStack = new OpenSearchMetricsWorkflowStack(app, 'OpenSearchMetrics-Workflow', {
opensearchDomainStack: openSearchDomainStack, vpcStack: vpcStack, lambdaPackage: Project.LAMBDA_PACKAGE
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please seperate this into a seperate lambda and a seperate stepfunction so that it wont mix up with existing metrics and can have its own cron and full 15 mins to execute the operation.

@bshien bshien marked this pull request as ready for review October 21, 2024 21:45
}
}
openSearchUtil.createIndexIfNotExists("github-events");
openSearchUtil.bulkIndex("github-events", finalEventData);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add as github-events-MM-YYY", this way we can clean up older data easily if required.


@Override
public Void handleRequest(Void input, Context context) {
final String yesterday = LocalDate.now(ZoneOffset.UTC).minus(1, ChronoUnit.DAYS).toString(); // yyyy-MM-dd
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please change yesterday to something like collectionStartTime and add comments that will default to yesterday.

@bshien bshien force-pushed the events-index-lambda branch 7 times, most recently from bfb1524 to d6b592c Compare October 24, 2024 17:20
@bshien bshien changed the title Added lambda to index events from s3 data lake to metrics cluster Added workflow to index events from s3 data lake to metrics cluster Oct 24, 2024
@bshien bshien merged commit 7a74093 into opensearch-project:main Oct 24, 2024
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

2 participants