mirror of
https://github.com/SigNoz/signoz.git
synced 2026-05-28 12:50:32 +01:00
Some checks failed
build-staging / prepare (push) Has been cancelled
Release Drafter / update_release_draft (push) Has been cancelled
build-staging / go-build (push) Has been cancelled
build-staging / staging (push) Has been cancelled
build-staging / js-build (push) Has been cancelled
* chore: added migration setup * feat(sqlmigration): add integration_dashboards table (migration 079) Adds the `integration_dashboards` relations table that stores the integration-specific identity for dashboards provisioned from cloud or builtin integrations. Columns: id, org_id, dashboard_id, provider, slug, created_at, updated_at. Includes a unique index on dashboard_id. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat(sqlmigration): backfill cloud integration dashboards to DB (migration 080) One-time idempotent migration that provisions dashboard rows for all orgs with existing cloud integration services where metrics are enabled. Each dashboard is inserted into the `dashboard` table with source="integration" and locked=true, and a companion row is added to `integration_dashboards` with provider="cloud_integrations" and slug="{provider}-{service}-{dashboard}" (e.g. aws-alb-overview). Idempotency is enforced by checking (org_id, provider, slug) on integration_dashboards before each insert. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore(sqlmigration): clean up stale 079 artifacts, add 079 schema migration Remove the pre-rename 079_migrate_cloud_integration_dashboards.go and 079_cloud_integration_dashboards/ directory that were left behind when the backfill migration was renumbered to 080. Add the missing 079_add_integration_dashboards.go (schema-only migration creating the integration_dashboards table) which provider.go already references. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * chore: adding comment for fk * refactor: renaming table name * refactor: rename and restructure cloud integration dashboard migration types * chore: file rename * refactor: dashboard creation and listing flow change * refactor: removing loose strings * refactor: adding DeleteBySource on dashboard module * refactor: review changes and update service flow change * refactor: simplify comments * ci: lint staticcheck fix * refactor: renaming migration and adding integration tests * ci: py fmt lint fixes * feat: adding ListSharedServices store method * ci: golangci-lint fix * refactor: code cleanup * chore: revert changed due to js lint * refactor: test assertion changes * refactor: using bindparam for sql generation * chore: migrate integration dashboards json to v5 (#11419) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Srikanth Chekuri <srikanth.chekuri92@gmail.com>
82 lines
4.4 KiB
Go
82 lines
4.4 KiB
Go
package cloudintegration
|
|
|
|
import (
|
|
"context"
|
|
"net/http"
|
|
|
|
"github.com/SigNoz/signoz/pkg/statsreporter"
|
|
citypes "github.com/SigNoz/signoz/pkg/types/cloudintegrationtypes"
|
|
"github.com/SigNoz/signoz/pkg/valuer"
|
|
)
|
|
|
|
type Module interface {
|
|
GetConnectionCredentials(ctx context.Context, orgID valuer.UUID, provider citypes.CloudProviderType) (*citypes.Credentials, error)
|
|
|
|
CreateAccount(ctx context.Context, account *citypes.Account) error
|
|
|
|
// GetAccount returns cloud integration account
|
|
GetAccount(ctx context.Context, orgID, accountID valuer.UUID, provider citypes.CloudProviderType) (*citypes.Account, error)
|
|
|
|
// GetConnectedAccount returns the account where agent is connected
|
|
GetConnectedAccount(ctx context.Context, orgID, accountID valuer.UUID, provider citypes.CloudProviderType) (*citypes.Account, error)
|
|
|
|
// ListAccounts lists accounts where agent is connected
|
|
ListAccounts(ctx context.Context, orgID valuer.UUID, provider citypes.CloudProviderType) ([]*citypes.Account, error)
|
|
|
|
// UpdateAccount updates the cloud integration account for a specific organization.
|
|
UpdateAccount(ctx context.Context, account *citypes.Account) error
|
|
|
|
// DisconnectAccount soft deletes/removes a cloud integration account.
|
|
DisconnectAccount(ctx context.Context, orgID, accountID valuer.UUID, provider citypes.CloudProviderType) error
|
|
|
|
// GetConnectionArtifact returns cloud provider specific connection information,
|
|
// client side handles how this information is shown
|
|
GetConnectionArtifact(ctx context.Context, account *citypes.Account, req *citypes.GetConnectionArtifactRequest) (*citypes.ConnectionArtifact, error)
|
|
|
|
// ListServicesMetadata returns the list of supported services' metadata for a cloud provider with optional filtering for a specific integration
|
|
// This just returns a summary of the service and not the whole service definition.
|
|
ListServicesMetadata(ctx context.Context, orgID valuer.UUID, provider citypes.CloudProviderType, integrationID valuer.UUID) ([]*citypes.ServiceMetadata, error)
|
|
|
|
// GetService returns service definition details for a serviceID. This optionally returns the service config
|
|
// for integrationID if provided.
|
|
GetService(ctx context.Context, orgID valuer.UUID, serviceID citypes.ServiceID, provider citypes.CloudProviderType, integrationID valuer.UUID) (*citypes.Service, error)
|
|
|
|
// CreateService creates a new service for a cloud integration account.
|
|
CreateService(ctx context.Context, orgID valuer.UUID, createdBy string, creator valuer.UUID, service *citypes.CloudIntegrationService, provider citypes.CloudProviderType) error
|
|
|
|
// UpdateService updates cloud integration service
|
|
UpdateService(ctx context.Context, orgID valuer.UUID, createdBy string, creator valuer.UUID, service *citypes.CloudIntegrationService, provider citypes.CloudProviderType) error
|
|
|
|
// AgentCheckIn is called by agent to send heartbeat and get latest config in response.
|
|
AgentCheckIn(ctx context.Context, orgID valuer.UUID, provider citypes.CloudProviderType, req *citypes.AgentCheckInRequest) (*citypes.AgentCheckInResponse, error)
|
|
|
|
statsreporter.StatsCollector
|
|
}
|
|
|
|
type CloudProviderModule interface {
|
|
GetConnectionArtifact(ctx context.Context, account *citypes.Account, req *citypes.GetConnectionArtifactRequest) (*citypes.ConnectionArtifact, error)
|
|
|
|
// ListServiceDefinitions returns all service definitions for this cloud provider.
|
|
ListServiceDefinitions(ctx context.Context) ([]*citypes.ServiceDefinition, error)
|
|
|
|
// GetServiceDefinition returns the service definition for the given service ID.
|
|
GetServiceDefinition(ctx context.Context, serviceID citypes.ServiceID) (*citypes.ServiceDefinition, error)
|
|
|
|
// BuildIntegrationConfig compiles the provider-specific integration config from the account
|
|
// and list of configured services. This is the config returned to the agent on check-in.
|
|
BuildIntegrationConfig(ctx context.Context, account *citypes.Account, services []*citypes.StorableCloudIntegrationService) (*citypes.ProviderIntegrationConfig, error)
|
|
}
|
|
|
|
type Handler interface {
|
|
GetConnectionCredentials(http.ResponseWriter, *http.Request)
|
|
CreateAccount(http.ResponseWriter, *http.Request)
|
|
ListAccounts(http.ResponseWriter, *http.Request)
|
|
GetAccount(http.ResponseWriter, *http.Request)
|
|
UpdateAccount(http.ResponseWriter, *http.Request)
|
|
DisconnectAccount(http.ResponseWriter, *http.Request)
|
|
ListServicesMetadata(http.ResponseWriter, *http.Request)
|
|
GetService(http.ResponseWriter, *http.Request)
|
|
UpdateService(http.ResponseWriter, *http.Request)
|
|
AgentCheckIn(http.ResponseWriter, *http.Request)
|
|
}
|