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

Migration Analytics Services to CDK #417

Conversation

mikaylathompson
Copy link
Collaborator

@mikaylathompson mikaylathompson commented Nov 13, 2023

Description

This PR brings the otel collector & opensearch domain for analytics established in #376 to our CDK solution for AWS. In a default deployment, it deploys the below components and adds the --otelCollectorEndpoint to the capture proxy and replayer so that they initialize the OpenTelemetry adapters and begin sending data.

Major Components:

  • Migration Analytics Cluster & Dashboard (OpenSearch Service Domain)
  • Open Telemetry Collector (ECS Fargate box running a custom build of OpenTelemetry [see here for details])
  • Bastion Host that allows a user to access their dashboard via port forwarding set up via a Session Manager connection (similar to how it's used in our accessContainer.sh script)

Missing documentation:

  • how to access the bastion host

Issues Resolved

MIGRATIONS-1415

Testing

This has been subject to a lot of manual testing, but the CDK itself is only covered by one fairly minimal test at this point.

Check List

  • New functionality includes testing
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented
  • Commits are signed per the DCO using --signoff

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 Nov 14, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9eed2d7) 63.16% compared to head (94cbe90) 63.16%.
Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #417   +/-   ##
=========================================
  Coverage     63.16%   63.16%           
  Complexity      873      873           
=========================================
  Files           100      100           
  Lines          4341     4341           
  Branches        410      410           
=========================================
  Hits           2742     2742           
  Misses         1328     1328           
  Partials        271      271           
Flag Coverage Δ
unittests 63.16% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Copy link
Collaborator

@lewijacn lewijacn left a comment

Choose a reason for hiding this comment

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

I think you already mentioned this in your update that documentation hadn't been added, but would love to see some documentation on steps a user needs to access the analytics dashboard

]
if (props.migrationAnalyticsEnabled) {
securityGroups.push(SecurityGroup.fromSecurityGroupId(this, "migrationAnalyticsSGId", StringParameter.valueForStringParameter(this, `/migration/${props.stage}/${props.defaultDeployId}/analyticsDomainSGId`)))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nothing to do about this right now, but we should rethink our security group pattern later. I think there may be a limit of 5 security groups per ECS service, and I think in our effort to try and limit access by valid use case we have reached that limit and may need to be more general

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, that's good to know.

description: "This stack prepares the Migration Analytics OS Domain",
domainAccessSecurityGroupParameter: "analyticsDomainSGId",
endpointParameterName: "analyticsDomainEndpoint",
version: this.getEngineVersion(analyticsDomainEngineVersion ?? engineVersion), // If no analytics version is specified, use the same as the target cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I'd like to use the opensearch latest by default, but understand there isn't a built in way to get this

Comment on lines +357 to +361
vpcSubnetIds: vpcSubnetIds,
vpcSecurityGroupIds: vpcSecurityGroupIds,
availabilityZoneCount: availabilityZoneCount,
dataNodeInstanceType: analyticsDomainDataNodeType,
dataNodes: analyticsDomainDataNodeCount ?? availabilityZoneCount, // There's probably a better way to do this, but the node count must be >= the zone count, and possibly must be the same even/odd as zone count
Copy link
Collaborator

Choose a reason for hiding this comment

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

TBD Comment, need to think about this a bit more

Signed-off-by: Mikayla Thompson <[email protected]>
@mikaylathompson mikaylathompson marked this pull request as ready for review November 14, 2023 19:15
Copy link
Collaborator

@lewijacn lewijacn left a comment

Choose a reason for hiding this comment

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

Things look good from what I can see. Any issue to run npm test? I was unable to get these successful but it seems like an issue with my local

Comment on lines +522 to +523
if (migrationAnalyticsStack) {
migrationConsoleStack.addDependency(migrationAnalyticsStack)
Copy link
Collaborator

Choose a reason for hiding this comment

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

We are missing bracket here

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ah, yikes, good catch.

Copy link
Collaborator

@lewijacn lewijacn left a comment

Choose a reason for hiding this comment

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

Marking as approved but we should add the missing bracket in my last review before merging to prevent messing up console and tests

Signed-off-by: Mikayla Thompson <[email protected]>
@mikaylathompson
Copy link
Collaborator Author

And yes, all tests pass:

Test Suites: 7 passed, 7 total
Tests:       41 passed, 41 total
Snapshots:   0 total
Time:        182.867 s
Ran all test suites.

@mikaylathompson mikaylathompson merged commit 73b076f into opensearch-project:main Nov 15, 2023
7 checks passed
@mikaylathompson mikaylathompson deleted the analytics-domain-service-in-cdk branch November 15, 2023 05:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants