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

feat: aws integration: UI facing QS api for cloud account management #6771

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

raj-k-singh
Copy link
Collaborator

@raj-k-singh raj-k-singh commented Jan 8, 2025

Summary

Adds Query Service APIs for powering AWS integrations UI

Related Issues / PR's

Contributes to #6544


Important

Adds AWS cloud account management API to Query Service with lifecycle operations and integration tests.

  • Behavior:
    • Adds CloudIntegrationsController in cloudintegrations/controller.go for managing AWS cloud accounts.
    • Implements API routes in http_handler.go for generating connection URLs, listing accounts, checking account status, updating config, and disconnecting accounts.
  • Database:
    • Initializes SQLite DB for cloud integrations in cloudintegrations/repo.go.
    • Defines AccountRecord and related models in cloudintegrations/model.go.
  • Testing:
    • Adds integration tests in signoz_cloud_integrations_test.go to validate AWS account lifecycle operations.
  • Misc:
    • Updates server.go to initialize CloudIntegrationsController and register routes.

This description was created by Ellipsis for 5e1246b. It will automatically update as commits are pushed.

@github-actions github-actions bot added docs required enhancement New feature or request labels Jan 8, 2025
@raj-k-singh raj-k-singh force-pushed the feat/aws-integration-ui-facing-api-0 branch 2 times, most recently from 202bc43 to 7d576aa Compare January 9, 2025 04:22
@raj-k-singh raj-k-singh force-pushed the feat/aws-integration-ui-facing-api-0 branch from 7d576aa to 5e1246b Compare January 9, 2025 04:23
@raj-k-singh raj-k-singh marked this pull request as ready for review January 9, 2025 04:23
Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Reviewed everything up to 5e1246b in 1 minute and 53 seconds

More details
  • Looked at 1390 lines of code in 11 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. pkg/query-service/utils/testutils.go:19
  • Draft comment:
    Consider checking the error returned by os.Remove in the cleanup function to ensure the temporary file is successfully deleted. This will help avoid leftover files in the system.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The function NewTestSqliteDB creates a temporary SQLite database for testing purposes. However, it does not handle the case where the temporary file cannot be removed during cleanup. This could lead to leftover files in the system.
2. pkg/query-service/utils/testutils.go:33
  • Draft comment:
    The TODO comment suggests that passing the DB file path should not be necessary. Consider refactoring the code to eliminate the need for passing the DB file path to dao.InitDao and dashboards.InitDB.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The NewQueryServiceDBForTests function initializes the DAO and dashboards with the test database file path. However, the TODO comment suggests that passing the DB file path should not be necessary. This indicates a potential area for improvement in the codebase.
3. pkg/query-service/app/cloudintegrations/controller.go:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable in other files as well.
  • Reason this comment was not posted:
    Comment was on unchanged code.
4. pkg/query-service/app/cloudintegrations/repo.go:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable in other files as well.
  • Reason this comment was not posted:
    Marked as duplicate.
5. pkg/query-service/app/cloudintegrations/model.go:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable in other files as well.
  • Reason this comment was not posted:
    Marked as duplicate.
6. pkg/query-service/app/cloudintegrations/controller_test.go:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach, as it makes it difficult to debug and find components using global search tools like VS Code. This is applicable in other files as well.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_wjestgZYRSegDlj2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Comment on lines +136 to +138
cloud_provider=?
and id in (%s)`,
strings.Join(idPlaceholders, ", "),
Copy link
Member

Choose a reason for hiding this comment

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

return nil, model.WrapApiError(apiErr, "couldn't upsert cloud account")
}

// TODO(Raj): Add actual cloudformation template for AWS integration after it has been shipped.
Copy link
Member

Choose a reason for hiding this comment

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

Just to follow, can you help me understand what does this template do? Does it setup the base or does it do anything with the AWS services?

aH.Respond(w, resp)
}

func (aH *APIHandler) CloudIntegrationsAgentCheckIn(
Copy link
Member

Choose a reason for hiding this comment

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

I couldn't find info related to this. Can you share the flow for this? Is it going to be some agent running in cloud provider that invokes this endpoint?

).Methods(http.MethodPost)

subRouter.HandleFunc(
"/{cloudProvider}/accounts/{accountId}/disconnect", am.EditAccess(aH.CloudIntegrationsDisconnectAccount),
Copy link
Member

Choose a reason for hiding this comment

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

If I want to reconnect, is it going to be simple toggle, or do I have to start from beginning again?

}

tsNow := time.Now()
account, apiErr := c.repo.upsert(
Copy link
Member

Choose a reason for hiding this comment

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

For delete, wouldn't it make more sense to throw error if account doesn't exist rather than upsert?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs required enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants