mirror of
https://git.mirrors.martin98.com/https://github.com/SigNoz/signoz
synced 2025-08-12 06:19:03 +08:00
Chore: integrations: populate updatedAt for integration dashboards (#5019)
* chore: add test for updatedAt value being populated in integration dashboards and get it passing * chore: also populate createdAt, createBy and updateBy for instaled integration dashboards * chore: update clickhouse integration config instructions
This commit is contained in:
parent
7e31b4ca01
commit
5a778dcb18
@ -78,3 +78,5 @@ Make the collector config file available to your otel collector and use it by ad
|
|||||||
```
|
```
|
||||||
Note: the collector can use multiple config files, specified by multiple occurrences of the --config flag.
|
Note: the collector can use multiple config files, specified by multiple occurrences of the --config flag.
|
||||||
|
|
||||||
|
Also note that only 1 collector instance should be configured to collect query_logs.
|
||||||
|
Using multiple collector instances or replicas with this config will lead to duplicate logs.
|
||||||
|
@ -30,7 +30,7 @@ To configure metrics and logs collection for a Clickhouse server, you need the f
|
|||||||
- **Ensure that an OTEL collector is running in your deployment environment**
|
- **Ensure that an OTEL collector is running in your deployment environment**
|
||||||
If needed, please [install SigNoz OTEL Collector](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/)
|
If needed, please [install SigNoz OTEL Collector](https://signoz.io/docs/tutorial/opentelemetry-binary-usage-in-virtual-machine/)
|
||||||
If already installed, ensure that the collector version is v0.88.0 or newer.
|
If already installed, ensure that the collector version is v0.88.0 or newer.
|
||||||
If collecting logs from system.query_log table, ensure that the collector version is v0.88.22 or newer.
|
If collecting logs from system.query_log table, ensure that the collector version is v0.88.23 or newer.
|
||||||
|
|
||||||
Also ensure that you can provide config files to the collector and that you can set environment variables and command line flags used for running it.
|
Also ensure that you can provide config files to the collector and that you can set environment variables and command line flags used for running it.
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ func (m *Manager) UninstallIntegration(
|
|||||||
func (m *Manager) GetPipelinesForInstalledIntegrations(
|
func (m *Manager) GetPipelinesForInstalledIntegrations(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
) ([]logparsingpipeline.Pipeline, *model.ApiError) {
|
) ([]logparsingpipeline.Pipeline, *model.ApiError) {
|
||||||
installedIntegrations, apiErr := m.getDetailsForInstalledIntegrations(ctx)
|
installedIntegrations, apiErr := m.getInstalledIntegrations(ctx)
|
||||||
if apiErr != nil {
|
if apiErr != nil {
|
||||||
return nil, apiErr
|
return nil, apiErr
|
||||||
}
|
}
|
||||||
@ -327,10 +327,15 @@ func (m *Manager) GetInstalledIntegrationDashboardById(
|
|||||||
if dId, exists := dd["id"]; exists {
|
if dId, exists := dd["id"]; exists {
|
||||||
if id, ok := dId.(string); ok && id == dashboardId {
|
if id, ok := dId.(string); ok && id == dashboardId {
|
||||||
isLocked := 1
|
isLocked := 1
|
||||||
|
author := "integration"
|
||||||
return &dashboards.Dashboard{
|
return &dashboards.Dashboard{
|
||||||
Uuid: m.dashboardUuid(integrationId, string(dashboardId)),
|
Uuid: m.dashboardUuid(integrationId, string(dashboardId)),
|
||||||
Locked: &isLocked,
|
Locked: &isLocked,
|
||||||
Data: dd,
|
Data: dd,
|
||||||
|
CreatedAt: integration.Installation.InstalledAt,
|
||||||
|
CreateBy: &author,
|
||||||
|
UpdatedAt: integration.Installation.InstalledAt,
|
||||||
|
UpdateBy: &author,
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -344,7 +349,7 @@ func (m *Manager) GetInstalledIntegrationDashboardById(
|
|||||||
func (m *Manager) GetDashboardsForInstalledIntegrations(
|
func (m *Manager) GetDashboardsForInstalledIntegrations(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
) ([]dashboards.Dashboard, *model.ApiError) {
|
) ([]dashboards.Dashboard, *model.ApiError) {
|
||||||
installedIntegrations, apiErr := m.getDetailsForInstalledIntegrations(ctx)
|
installedIntegrations, apiErr := m.getInstalledIntegrations(ctx)
|
||||||
if apiErr != nil {
|
if apiErr != nil {
|
||||||
return nil, apiErr
|
return nil, apiErr
|
||||||
}
|
}
|
||||||
@ -356,10 +361,15 @@ func (m *Manager) GetDashboardsForInstalledIntegrations(
|
|||||||
if dId, exists := dd["id"]; exists {
|
if dId, exists := dd["id"]; exists {
|
||||||
if dashboardId, ok := dId.(string); ok {
|
if dashboardId, ok := dId.(string); ok {
|
||||||
isLocked := 1
|
isLocked := 1
|
||||||
|
author := "integration"
|
||||||
result = append(result, dashboards.Dashboard{
|
result = append(result, dashboards.Dashboard{
|
||||||
Uuid: m.dashboardUuid(ii.IntegrationSummary.Id, dashboardId),
|
Uuid: m.dashboardUuid(ii.IntegrationSummary.Id, dashboardId),
|
||||||
Locked: &isLocked,
|
Locked: &isLocked,
|
||||||
Data: dd,
|
Data: dd,
|
||||||
|
CreatedAt: ii.Installation.InstalledAt,
|
||||||
|
CreateBy: &author,
|
||||||
|
UpdatedAt: ii.Installation.InstalledAt,
|
||||||
|
UpdateBy: &author,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -418,10 +428,10 @@ func (m *Manager) getInstalledIntegration(
|
|||||||
return &installation, nil
|
return &installation, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Manager) getDetailsForInstalledIntegrations(
|
func (m *Manager) getInstalledIntegrations(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
) (
|
) (
|
||||||
map[string]IntegrationDetails, *model.ApiError,
|
map[string]Integration, *model.ApiError,
|
||||||
) {
|
) {
|
||||||
installations, apiErr := m.installedIntegrationsRepo.list(ctx)
|
installations, apiErr := m.installedIntegrationsRepo.list(ctx)
|
||||||
if apiErr != nil {
|
if apiErr != nil {
|
||||||
@ -431,5 +441,24 @@ func (m *Manager) getDetailsForInstalledIntegrations(
|
|||||||
installedIds := utils.MapSlice(installations, func(i InstalledIntegration) string {
|
installedIds := utils.MapSlice(installations, func(i InstalledIntegration) string {
|
||||||
return i.IntegrationId
|
return i.IntegrationId
|
||||||
})
|
})
|
||||||
return m.availableIntegrationsRepo.get(ctx, installedIds)
|
integrationDetails, apiErr := m.availableIntegrationsRepo.get(ctx, installedIds)
|
||||||
|
if apiErr != nil {
|
||||||
|
return nil, apiErr
|
||||||
|
}
|
||||||
|
|
||||||
|
result := map[string]Integration{}
|
||||||
|
for _, ii := range installations {
|
||||||
|
iDetails, exists := integrationDetails[ii.IntegrationId]
|
||||||
|
if !exists {
|
||||||
|
return nil, model.InternalError(fmt.Errorf(
|
||||||
|
"couldn't find integration details for %s", ii.IntegrationId,
|
||||||
|
))
|
||||||
|
}
|
||||||
|
|
||||||
|
result[ii.IntegrationId] = Integration{
|
||||||
|
Installation: &ii,
|
||||||
|
IntegrationDetails: iDetails,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result, nil
|
||||||
}
|
}
|
||||||
|
@ -327,6 +327,7 @@ func TestDashboardsForInstalledIntegrationDashboards(t *testing.T) {
|
|||||||
|
|
||||||
// Installing an integration should make its dashboards appear in the dashboard list
|
// Installing an integration should make its dashboards appear in the dashboard list
|
||||||
require.False(testAvailableIntegration.IsInstalled)
|
require.False(testAvailableIntegration.IsInstalled)
|
||||||
|
tsBeforeInstallation := time.Now().Unix()
|
||||||
integrationsTB.RequestQSToInstallIntegration(
|
integrationsTB.RequestQSToInstallIntegration(
|
||||||
testAvailableIntegration.Id, map[string]interface{}{},
|
testAvailableIntegration.Id, map[string]interface{}{},
|
||||||
)
|
)
|
||||||
@ -344,9 +345,13 @@ func TestDashboardsForInstalledIntegrationDashboards(t *testing.T) {
|
|||||||
len(testIntegrationDashboards), len(dashboards),
|
len(testIntegrationDashboards), len(dashboards),
|
||||||
"dashboards for installed integrations should appear in dashboards list",
|
"dashboards for installed integrations should appear in dashboards list",
|
||||||
)
|
)
|
||||||
|
require.GreaterOrEqual(dashboards[0].CreatedAt.Unix(), tsBeforeInstallation)
|
||||||
|
require.GreaterOrEqual(dashboards[0].UpdatedAt.Unix(), tsBeforeInstallation)
|
||||||
|
|
||||||
// Should be able to get installed integrations dashboard by id
|
// Should be able to get installed integrations dashboard by id
|
||||||
dd := integrationsTB.GetDashboardByIdFromQS(dashboards[0].Uuid)
|
dd := integrationsTB.GetDashboardByIdFromQS(dashboards[0].Uuid)
|
||||||
|
require.GreaterOrEqual(dd.CreatedAt.Unix(), tsBeforeInstallation)
|
||||||
|
require.GreaterOrEqual(dd.UpdatedAt.Unix(), tsBeforeInstallation)
|
||||||
require.Equal(*dd, dashboards[0])
|
require.Equal(*dd, dashboards[0])
|
||||||
|
|
||||||
// Integration dashboards should not longer appear in dashboard list after uninstallation
|
// Integration dashboards should not longer appear in dashboard list after uninstallation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user