Repository: SigNoz/signoz
Pull request #7863: fix: changed the keys in the default quick filters to actual keys in …
Author: login: eKuG
Labels: name: bug
description: Something isn't working
name: docs shipped
name: safe-to-integrate
description: Run integration tests
name: staging:evolving-elephant
Created: 2025-05-08T06:37:20Z | Merged: 2025-05-12T10:50:47Z

### Summary

changed the keys in the default quick filters to actual keys in v3.AttributeKeys



<!-- ELLIPSIS_HIDDEN -->


----

> [!IMPORTANT]
> Update quick filter keys to match `v3.AttributeKeys` and add SQL migration to recreate filters with updated keys.
> 
>   - **Behavior**:
>     - Updates keys in `NewDefaultQuickFilter` in `filter.go` to match `v3.AttributeKeys`.
>     - Adds `NewUpdateQuickFiltersFactory` in `provider.go` to handle quick filter updates.
>     - New SQL migration `031_update_quick_filters.go` deletes existing quick filters and recreates them with updated keys for each organization.
>   - **Migration**:
>     - `Up` function in `031_update_quick_filters.go` deletes all quick filters and recreates them using `NewDefaultQuickFilter`.
>     - `Down` function in `031_update_quick_filters.go` is a no-op.
>   - **Misc**:
>     - Adds `NewUpdateQuickFiltersFactory` to `NewSQLMigrationProviderFactories` in `provider.go`.
> 
> <sup>This description was created by </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> for d421e40f0bb11d052f151b0a5debc715713510b9. You can [customize](https://app.ellipsis.dev/SigNoz/settings/summaries) this summary. It will automatically update as commits are pushed.</sup>


<!-- ELLIPSIS_HIDDEN -->


Diff:
diff --git a/pkg/signoz/provider.go b/pkg/signoz/provider.go
index 9b35c4cf5c5..85e832760d6 100644
--- a/pkg/signoz/provider.go
+++ b/pkg/signoz/provider.go
@@ -75,6 +75,7 @@ func NewSQLMigrationProviderFactories(sqlstore sqlstore.SQLStore) factory.NamedM
 		sqlmigration.NewUpdateOrganizationsFactory(sqlstore),
 		sqlmigration.NewDropGroupsFactory(sqlstore),
 		sqlmigration.NewCreateQuickFiltersFactory(sqlstore),
+		sqlmigration.NewUpdateQuickFiltersFactory(sqlstore),
 	)
 }
 
diff --git a/pkg/sqlmigration/031_update_quick_filters.go b/pkg/sqlmigration/031_update_quick_filters.go
new file mode 100644
index 00000000000..3f413548de3
--- /dev/null
+++ b/pkg/sqlmigration/031_update_quick_filters.go
@@ -0,0 +1,103 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
+		Exec(ctx)
+	if err != nil {
+		return err
+	}
+
+	// Get all organization IDs as strings
+	var orgIDs []string
+	err = tx.NewSelect().
+		Table("organizations").
+		Column("id").
+		Scan(ctx, &orgIDs)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			// No organizations found, commit the transaction (deletion is done) and return
+			if err := tx.Commit(); err != nil {
+				return err
+			}
+			return nil
+		}
+		return err
+	}
+
+	// For each organization, create new quick filters with the updated NewDefaultQuickFilter function
+	for _, orgID := range orgIDs {
+		// Get the updated default quick filters
+		storableQuickFilters, err := quickfiltertypes.NewDefaultQuickFilter(valuer.MustNewUUID(orgID))
+		if err != nil {
+			return err
+		}
+
+		// Insert all filters for this organization
+		_, err = tx.NewInsert().
+			Model(&storableQuickFilters).
+			Exec(ctx)
+
+		if err != nil {
+			if errors.Ast(migration.store.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "Quick Filter already exists"), errors.TypeAlreadyExists) {
+				// Skip if filters already exist for this org
+				continue
+			}
+			return err
+		}
+	}
+
+	if err := tx.Commit(); err != nil {
+		return err
+	}
+	return nil
+}
+
+func (migration *updateQuickFilters) Down(ctx context.Context, db *bun.DB) error {
+	return nil
+}
diff --git a/pkg/types/quickfiltertypes/filter.go b/pkg/types/quickfiltertypes/filter.go
index 4a9fe62f967..ecfa9cfdb90 100644
--- a/pkg/types/quickfiltertypes/filter.go
+++ b/pkg/types/quickfiltertypes/filter.go
@@ -139,21 +139,21 @@ func NewDefaultQuickFilter(orgID valuer.UUID) ([]*StorableQuickFilter, error) {
 		{"key": "duration_nano", "dataType": "float64", "type": "tag"},
 		{"key": "deployment.environment", "dataType": "string", "type": "resource"},
 		{"key": "hasError", "dataType": "bool", "type": "tag"},
-		{"key": "serviceName", "dataType": "string", "type": "tag"},
-		{"key": "name", "dataType": "string", "type": "resource"},
-		{"key": "rpcMethod", "dataType": "string", "type": "tag"},
-		{"key": "responseStatusCode", "dataType": "string", "type": "resource"},
-		{"key": "httpHost", "dataType": "string", "type": "tag"},
-		{"key": "httpMethod", "dataType": "string", "type": "tag"},
-		{"key": "httpRoute", "dataType": "string", "type": "tag"},
-		{"key": "httpUrl", "dataType": "string", "type": "tag"},
-		{"key": "traceID", "dataType": "string", "type": "tag"},
+		{"key": "service.name", "dataType": "string", "type": "resource"},
+		{"key": "name", "dataType": "string", "type": "tag"},
+		{"key": "rpc.method", "dataType": "string", "type": "tag"},
+		{"key": "response_status_code", "dataType": "string", "type": "tag"},
+		{"key": "http_host", "dataType": "string", "type": "tag"},
+		{"key": "http.method", "dataType": "string", "type": "tag"},
+		{"key": "http.route", "dataType": "string", "type": "tag"},
+		{"key": "http_url", "dataType": "string", "type": "tag"},
+		{"key": "trace_id", "dataType": "string", "type": "tag"},
 	}
 
 	logsFilters := []map[string]interface{}{
 		{"key": "severity_text", "dataType": "string", "type": "resource"},
 		{"key": "deployment.environment", "dataType": "string", "type": "resource"},
-		{"key": "serviceName", "dataType": "string", "type": "tag"},
+		{"key": "service.name", "dataType": "string", "type": "resource"},
 		{"key": "host.name", "dataType": "string", "type": "resource"},
 		{"key": "k8s.cluster.name", "dataType": "string", "type": "resource"},
 		{"key": "k8s.deployment.name", "dataType": "string", "type": "resource"},
@@ -163,18 +163,18 @@ func NewDefaultQuickFilter(orgID valuer.UUID) ([]*StorableQuickFilter, error) {
 
 	apiMonitoringFilters := []map[string]interface{}{
 		{"key": "deployment.environment", "dataType": "string", "type": "resource"},
-		{"key": "serviceName", "dataType": "string", "type": "tag"},
-		{"key": "rpcMethod", "dataType": "string", "type": "tag"},
+		{"key": "service.name", "dataType": "string", "type": "tag"},
+		{"key": "rpc.method", "dataType": "string", "type": "tag"},
 	}
 
 	exceptionsFilters := []map[string]interface{}{
 		{"key": "deployment.environment", "dataType": "string", "type": "resource"},
-		{"key": "serviceName", "dataType": "string", "type": "tag"},
+		{"key": "service.name", "dataType": "string", "type": "resource"},
 		{"key": "host.name", "dataType": "string", "type": "resource"},
-		{"key": "k8s.cluster.name", "dataType": "string", "type": "tag"},
+		{"key": "k8s.cluster.name", "dataType": "string", "type": "resource"},
 		{"key": "k8s.deployment.name", "dataType": "string", "type": "resource"},
-		{"key": "k8s.namespace.name", "dataType": "string", "type": "tag"},
-		{"key": "k8s.pod.name", "dataType": "string", "type": "tag"},
+		{"key": "k8s.namespace.name", "dataType": "string", "type": "resource"},
+		{"key": "k8s.pod.name", "dataType": "string", "type": "resource"},
 	}
 
 	tracesJSON, err := json.Marshal(tracesFilters)


Reviews:
user: login: ellipsis-dev[bot]
body: > [!IMPORTANT]
> **Looks good to me!  :+1:**
> <details>
> <summary>Reviewed everything up to 47bb51960d60c77de3277e5d24201274065d318b in <ellipsistime>2 minutes and 5 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `52` lines of code in `1` files
> - Skipped `0` files when reviewing.
> - Skipped posting `10` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> Renamed 'serviceName' to 'service.name' in tracesFilters. This aligns with v3.AttributeKeys. Confirm that all dependent usages are updated.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the PR author to confirm that all dependent usages are updated, which violates the rule against asking the author to confirm or double-check things. The first part of the comment is purely informative, which is also against the rules. Therefore, this comment should not be approved.
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/types/quickfiltertypes/filter.go:144</code></summary>
> 
> - **Draft comment:** 
> Renamed keys: 'rpcMethod' to 'rpc.method', 'responseStatusCode' to 'response_status_code', and similar updates for HTTP related fields in tracesFilters. Ensure consistency with v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, as it only describes what changes were made without providing any actionable feedback or suggestions. It doesn't ask for confirmation of intention or suggest any improvements.
> 
> 
> </details>
> 
> <details>
> <summary>3. <code>pkg/types/quickfiltertypes/filter.go:156</code></summary>
> 
> - **Draft comment:** 
> Updated 'serviceName' to 'service.name' in logsFilters for consistency with attribute keys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, as it only describes a change that was made without providing any actionable feedback or suggestions. It doesn't ask for confirmation or suggest any improvements.
> 
> 
> </details>
> 
> <details>
> <summary>4. <code>pkg/types/quickfiltertypes/filter.go:166</code></summary>
> 
> - **Draft comment:** 
> Modified apiMonitoringFilters: changed 'serviceName' to 'service.name' and 'rpcMethod' to 'rpc.method'. Verify that these match the definitions in v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the PR author to verify if the changes match the definitions in `v3.AttributeKeys`. This falls under asking the author to double-check things, which is against the rules. Therefore, this comment should not be approved.
> 
> 
> </details>
> 
> <details>
> <summary>5. <code>pkg/types/quickfiltertypes/filter.go:172</code></summary>
> 
> - **Draft comment:** 
> In exceptionsFilters, changed 'serviceName' to 'service.name'. Confirm this change is reflected consistently across the system.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment asks the PR author to confirm that a change is reflected consistently across the system, which violates the rule against asking for confirmation or double-checking. It doesn't provide a specific suggestion or point out a specific issue.
> 
> 
> </details>
> 
> <details>
> <summary>6. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> Updated quick filter key from "serviceName" to "service.name" in the tracesFilters block to match v3.AttributeKeys. Ensure that any persisted filters using the old key are handled (e.g., via migration) to avoid backward compatibility issues.
> - **Reason this comment was not posted:**
> Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% The comment is about data migration and backward compatibility, which is a valid concern. However, it's speculative ("ensure that...") and asks for verification rather than pointing out a specific issue. It's also not clear if this is actually needed without more context about how these filters are persisted and used. The comment violates the rule about not asking for verification or making speculative comments. The migration concern could be legitimate - if there are existing filters in production using the old keys, they would break. Maybe this is a critical issue that needs addressing. While data migration is important, the comment is phrased as a verification request rather than pointing out a specific issue. If migration was required, it should be part of the implementation plan, not a review comment asking to check. The comment should be removed as it violates the rules against asking for verification and making speculative comments. If migration is needed, it should be part of the implementation plan.
> 
> 
> </details>
> 
> <details>
> <summary>7. <code>pkg/types/quickfiltertypes/filter.go:155</code></summary>
> 
> - **Draft comment:** 
> Adjusted logsFilters: key updated from "serviceName" to "service.name" to align with v3.AttributeKeys definitions.
> - **Reason this comment was not posted:**
> Confidence changes required: `0%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>8. <code>pkg/types/quickfiltertypes/filter.go:166</code></summary>
> 
> - **Draft comment:** 
> In apiMonitoringFilters, changed keys from "serviceName" to "service.name" and "rpcMethod" to "rpc.method". Confirm that downstream consumers expect these key formats.
> - **Reason this comment was not posted:**
> Confidence changes required: `0%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>9. <code>pkg/types/quickfiltertypes/filter.go:172</code></summary>
> 
> - **Draft comment:** 
> In exceptionsFilters, updated key from "serviceName" to "service.name". Verify that any query or filter logic using this key is consistent with the new naming.
> - **Reason this comment was not posted:**
> Confidence changes required: `0%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>10. <code>pkg/types/quickfiltertypes/filter.go:191</code></summary>
> 
> - **Draft comment:** 
> Typographical consistency: The error message on line 192 uses "failed to marshal Api Monitoring filters" with 'Api' capitalized. For consistency with other error messages (e.g., using lowercase or standard acronyms like "API monitoring filters"), consider revising the casing to maintain a consistent style.
> - **Reason this comment was not posted:**
> Comment was not on a location in the diff, so it can't be submitted as a review comment.
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_v3KSPLcQys5EDI3c`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T06:39:29Z
user: login: ellipsis-dev[bot]
body: > [!IMPORTANT]
> **Looks good to me!  :+1:**
> <details>
> <summary>Reviewed caf673c7536a4730a542389d5e62967a4df96063 in <ellipsistime>1 minute and 46 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `52` lines of code in `1` files
> - Skipped `0` files when reviewing.
> - Skipped posting `12` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> Updated quick filter key from 'serviceName' to 'service.name' to match v3.AttributeKeys. Looks good.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, explaining a change that was made without providing any actionable feedback or suggestions. It does not align with the rules for useful comments.
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/types/quickfiltertypes/filter.go:144</code></summary>
> 
> - **Draft comment:** 
> Renamed key from 'rpcMethod' to 'rpc.method'. This change appears consistent.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, as it simply acknowledges a change without providing any actionable feedback or suggestions. It does not align with the rules for useful comments.
> 
> 
> </details>
> 
> <details>
> <summary>3. <code>pkg/types/quickfiltertypes/filter.go:145</code></summary>
> 
> - **Draft comment:** 
> Updated 'responseStatusCode' to 'response_status_code'; ensure consistency with attribute naming conventions.
> - **Reason this comment was not posted:**
> Comment looked like it was already resolved.
> 
> 
> </details>
> 
> <details>
> <summary>4. <code>pkg/types/quickfiltertypes/filter.go:146</code></summary>
> 
> - **Draft comment:** 
> Changed 'httpHost' to 'http.host' and similarly for httpMethod, httpRoute, and httpUrl. Review these for consistency.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is asking the author to review changes for consistency, which is similar to asking them to double-check their work. It doesn't provide a specific suggestion or point out a clear issue. Therefore, it violates the rule against asking the author to confirm or ensure things.
> 
> 
> </details>
> 
> <details>
> <summary>5. <code>pkg/types/quickfiltertypes/filter.go:156</code></summary>
> 
> - **Draft comment:** 
> Updated key in logsFilters from 'serviceName' to 'service.name'. This aligns with the v3.AttributeKeys naming.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, explaining a change that was made without providing any actionable feedback or suggestions. It does not align with the rules for useful comments, as it does not ask for confirmation, suggest improvements, or highlight potential issues.
> 
> 
> </details>
> 
> <details>
> <summary>6. <code>pkg/types/quickfiltertypes/filter.go:166</code></summary>
> 
> - **Draft comment:** 
> Updated 'serviceName' to 'service.name' and 'rpcMethod' to 'rpc.method' in apiMonitoringFilters.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, as it only describes what was changed without providing any suggestions, questions, or issues to address. It does not align with the rules for useful comments.
> 
> 
> </details>
> 
> <details>
> <summary>7. <code>pkg/types/quickfiltertypes/filter.go:172</code></summary>
> 
> - **Draft comment:** 
> Updated key in exceptionsFilters from 'serviceName' to 'service.name' for consistency.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is purely informative, as it only describes a change that was made without providing any actionable feedback or suggestions. It does not align with the rules for useful comments.
> 
> 
> </details>
> 
> <details>
> <summary>8. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> Updated key 'serviceName' to 'service.name'. Consider using a constant from v3.AttributeKeys to avoid hardcoding strings.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>9. <code>pkg/types/quickfiltertypes/filter.go:144</code></summary>
> 
> - **Draft comment:** 
> Updated several keys in tracesFilters (e.g. 'rpcMethod' → 'rpc.method', 'responseStatusCode' → 'response_status_code', etc.). Verify that mixed notation (dot vs underscore) is intentional per v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>10. <code>pkg/types/quickfiltertypes/filter.go:156</code></summary>
> 
> - **Draft comment:** 
> Changed 'serviceName' to 'service.name' in logsFilters. Using shared constants could help maintain consistency.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>11. <code>pkg/types/quickfiltertypes/filter.go:166</code></summary>
> 
> - **Draft comment:** 
> In apiMonitoringFilters, updated keys: 'serviceName' → 'service.name' and 'rpcMethod' → 'rpc.method'. Consider referencing constants to avoid discrepancies in the future.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>12. <code>pkg/types/quickfiltertypes/filter.go:172</code></summary>
> 
> - **Draft comment:** 
> Updated 'serviceName' to 'service.name' in exceptionsFilters. Using constants from v3.AttributeKeys might improve maintainability.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_DmSRwUQsqubTkqN5`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-08T08:17:57Z
user: login: ellipsis-dev[bot]
body: > [!CAUTION]
> **Changes requested  :x:**
> <details>
> <summary>Reviewed 0deefe4113f5dbf6ac7315bcc2fb27d21adc782c in <ellipsistime>1 minute and 52 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `118` lines of code in `2` files
> - Skipped `0` files when reviewing.
> - Skipped posting `7` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/sqlmigration/031_update_quick_filters.go:48</code></summary>
> 
> - **Draft comment:** 
> Double-check the deletion logic using 'Where("1=1")'. Ensure this unconditional delete is intentional.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `40%` <= threshold `50%` The comment is asking the PR author to double-check the deletion logic, which violates the rule against asking the author to confirm their intention or to double-check things. However, it does point out a potential issue with an unconditional delete, which could be a serious concern. The comment could be rephrased to focus on confirming the intention without asking for a double-check.
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/sqlmigration/031_update_quick_filters.go:98</code></summary>
> 
> - **Draft comment:** 
> The Down migration returns nil, making this migration irreversible. Consider documenting or implementing a rollback if needed.
> - **Reason this comment was not posted:**
> Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% This is a data migration that replaces all quick filters with new default ones. The Up migration deletes existing data and creates new data. A Down migration would need to restore the previous state, but that data is lost during the Up migration. Since we can't restore the exact previous state, having an empty Down migration is actually reasonable here. The comment suggests documenting this, but that's not a required code change. Maybe having some form of Down migration that at least attempts to restore default filters would be better than nothing? Or perhaps we should backup the data before deletion? While those are valid considerations, they go beyond the scope of this PR. The empty Down migration is a valid approach for one-way data migrations where exact restoration isn't possible. The comment should be deleted. Having an empty Down migration is a valid pattern for one-way data migrations, and the suggestion to document or implement a rollback isn't a required code change.
> 
> 
> </details>
> 
> <details>
> <summary>3. <code>pkg/signoz/provider.go:77</code></summary>
> 
> - **Draft comment:** 
> Ensure the new update migration is placed correctly and that its naming is consistent with other migration functions.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>4. <code>pkg/sqlmigration/031_update_quick_filters.go:20</code></summary>
> 
> - **Draft comment:** 
> The helper function is named 'newResetQuickFilters' but creates an update migration; consider renaming it to 'newUpdateQuickFilters' for clarity.
> - **Reason this comment was not posted:**
> Marked as duplicate.
> 
> 
> </details>
> 
> <details>
> <summary>5. <code>pkg/sqlmigration/031_update_quick_filters.go:76</code></summary>
> 
> - **Draft comment:** 
> Using valuer.MustNewUUID(orgID) may panic if orgID isn't a valid UUID; consider handling the conversion error more gracefully.
> - **Reason this comment was not posted:**
> Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 20% vs. threshold = 50% Since orgIDs come directly from the database's organizations table, they should already be valid UUIDs. This is a database migration script, so data integrity should be assumed. The function already has error handling after the MustNewUUID call. The comment seems overly cautious given the context. I could be wrong about the database schema - maybe the id column doesn't enforce UUID format. Also, MustNewUUID does indicate some risk by its name. Even if IDs weren't perfectly valid, this is a migration script where we want to fail fast if data is corrupt. Using Must* is appropriate here. The comment should be deleted as it suggests defensive programming in a context where failing fast on corrupt data is appropriate.
> 
> 
> </details>
> 
> <details>
> <summary>6. <code>pkg/sqlmigration/031_update_quick_filters.go:87</code></summary>
> 
> - **Draft comment:** 
> The error handling using errors.Ast is a bit dense; simplifying the logic or adding inline comments might improve clarity.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>7. <code>pkg/sqlmigration/031_update_quick_filters.go:98</code></summary>
> 
> - **Draft comment:** 
> The Down migration is left unimplemented; if rollback is necessary, consider adding the appropriate reversal logic or a clear comment explaining the intentional no-op.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_E9VAdODXqVfLbq48`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-11T17:23:16Z
user: login: ellipsis-dev[bot]
body: > [!IMPORTANT]
> **Looks good to me!  :+1:**
> <details>
> <summary>Reviewed cfafc3e569abc1ffcc5bdc7094cc26b2797c2332 in <ellipsistime>45 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `18` lines of code in `1` files
> - Skipped `0` files when reviewing.
> - Skipped posting `4` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/sqlmigration/031_update_quick_filters.go:21</code></summary>
> 
> - **Draft comment:** 
> Refactor correctly updates the function call to newUpdateQuickFilters. Ensure this change aligns with quick filter key updates.
> - **Reason this comment was not posted:**
> Confidence changes required: `0%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/sqlmigration/031_update_quick_filters.go:25</code></summary>
> 
> - **Draft comment:** 
> Renaming the function to newUpdateQuickFilters enhances clarity. Verify that corresponding tests are updated if they referenced the old name.
> - **Reason this comment was not posted:**
> Confidence changes required: `0%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>3. <code>pkg/sqlmigration/031_update_quick_filters.go:21</code></summary>
> 
> - **Draft comment:** 
> Renaming the function call from newResetQuickFilters to newUpdateQuickFilters improves clarity and aligns with the PR description. Ensure that this change is in sync with the intended key updates in quick filters.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the PR author to ensure that the renaming of a function is in sync with intended updates. This falls under asking the author to confirm their intention, which is against the rules. Therefore, this comment should not be approved.
> 
> 
> </details>
> 
> <details>
> <summary>4. <code>pkg/sqlmigration/031_update_quick_filters.go:25</code></summary>
> 
> - **Draft comment:** 
> Renaming the constructor function to newUpdateQuickFilters enhances clarity. Verify that any business logic updates for the quick filter keys (per v3.AttributeKeys) are correctly handled elsewhere.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `50%` <= threshold `50%` The comment suggests renaming a function for clarity, which is a valid suggestion. However, it also asks the author to verify business logic updates, which violates the rule against asking for verification. The first part of the comment is useful, but the second part is not allowed.
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_QKiXmXbKKZHSIC97`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T05:06:03Z
user: login: therealpandey
state: DISMISSED
author_association: MEMBER
submitted_at: 2025-05-12T07:31:13Z
user: login: ellipsis-dev[bot]
body: > [!IMPORTANT]
> **Looks good to me!  :+1:**
> <details>
> <summary>Reviewed a588001126239d85919b819915a7ab0b58e5d420 in <ellipsistime>1 minute and 46 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `49` lines of code in `1` files
> - Skipped `0` files when reviewing.
> - Skipped posting `11` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> Changed 'service.name' in tracesFilters from type 'tag' to 'resource'. Confirm that this mapping aligns with the intended attribute key semantics.
> - **Reason this comment was not posted:**
> Comment looked like it was already resolved.
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/types/quickfiltertypes/filter.go:143</code></summary>
> 
> - **Draft comment:** 
> Swapped type for 'name' in tracesFilters from 'resource' to 'tag'. Ensure this change matches the actual attribute key mapping in v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the author to ensure that the change matches the actual attribute key mapping in `v3.AttributeKeys`. This is a request for confirmation, which violates the rule against asking the PR author to confirm their intention or ensure behavior. Therefore, this comment should not be approved.
> 
> 
> </details>
> 
> <details>
> <summary>3. <code>pkg/types/quickfiltertypes/filter.go:146</code></summary>
> 
> - **Draft comment:** 
> Renamed keys 'http.host' to 'http_host' and 'http.url' to 'http_url' in tracesFilters. Confirm these new keys are used consistently across the codebase.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the PR author to confirm that the new keys are used consistently across the codebase. This falls under the rule of not asking the author to double-check things or ensure behavior is intended. Therefore, this comment should be removed.
> 
> 
> </details>
> 
> <details>
> <summary>4. <code>pkg/types/quickfiltertypes/filter.go:156</code></summary>
> 
> - **Draft comment:** 
> Changed 'service.name' in logsFilters from type 'tag' to 'resource'. Validate that this adheres to the expected attribute key definitions.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is asking the PR author to validate a change, which violates the rule against asking for confirmation or validation. It does not provide a specific suggestion or point out a clear issue with the code.
> 
> 
> </details>
> 
> <details>
> <summary>5. <code>pkg/types/quickfiltertypes/filter.go:171</code></summary>
> 
> - **Draft comment:** 
> Updated 'service.name' and 'k8s.cluster.name' in exceptionsFilters to type 'resource' instead of 'tag'. Ensure these new type assignments are consistent with v3.AttributeKeys expectations.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the author to ensure consistency with `v3.AttributeKeys` expectations, which violates the rule against asking the author to ensure behavior is intended. It does not provide a specific suggestion or ask for a specific test to be written.
> 
> 
> </details>
> 
> <details>
> <summary>6. <code>pkg/types/quickfiltertypes/filter.go:176</code></summary>
> 
> - **Draft comment:** 
> Changed 'k8s.namespace.name' and 'k8s.pod.name' in exceptionsFilters to type 'resource' from 'tag'. Confirm that these modifications correctly reflect the intended data model.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is asking the PR author to confirm their intention regarding a change in data model types. It violates the rule against asking for confirmation of intention or correctness.
> 
> 
> </details>
> 
> <details>
> <summary>7. <code>pkg/types/quickfiltertypes/filter.go:142</code></summary>
> 
> - **Draft comment:** 
> In the tracesFilters array, the key 'service.name' was changed from type 'tag' to 'resource', and the key 'name' from 'resource' to 'tag'. Confirm that this swap aligns with the attribute definitions in v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment looked like it was already resolved.
> 
> 
> </details>
> 
> <details>
> <summary>8. <code>pkg/types/quickfiltertypes/filter.go:145</code></summary>
> 
> - **Draft comment:** 
> The HTTP keys are now renamed from dotted notation ('http.host', 'http.url') to underscore ('http_host', 'http_url') and the type for 'response_status_code' changed from resource to tag. Verify that these key names and types are consistent with the expected v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is asking the PR author to verify consistency with `v3.AttributeKeys`, which is against the rule of asking the author to verify or ensure something. It doesn't provide a specific suggestion or point out a clear issue.
> 
> 
> </details>
> 
> <details>
> <summary>9. <code>pkg/types/quickfiltertypes/filter.go:156</code></summary>
> 
> - **Draft comment:** 
> In the logsFilters array, the 'service.name' key has been updated from type 'tag' to 'resource'. Please ensure that this reflects the proper categorization as defined in v3.AttributeKeys.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` This comment is asking the PR author to ensure that the change reflects the proper categorization, which violates the rule against asking the author to confirm their intention or ensure behavior. It doesn't provide a specific suggestion or point out a clear issue.
> 
> 
> </details>
> 
> <details>
> <summary>10. <code>pkg/types/quickfiltertypes/filter.go:171</code></summary>
> 
> - **Draft comment:** 
> In the exceptionsFilters array, several keys were updated: 'service.name' and 'k8s.cluster.name' now have type 'resource' instead of 'tag', and similarly for 'k8s.namespace.name' and 'k8s.pod.name'. Confirm these modifications are in line with the v3.AttributeKeys specifications.
> - **Reason this comment was not posted:**
> Comment did not seem useful. Confidence is useful = `0%` <= threshold `50%` The comment is asking the PR author to confirm that the modifications are in line with the `v3.AttributeKeys` specifications. This violates the rule against asking the author to confirm their intention or ensure behavior is intended. Therefore, this comment should not be approved.
> 
> 
> </details>
> 
> <details>
> <summary>11. <code>pkg/types/quickfiltertypes/filter.go:190</code></summary>
> 
> - **Draft comment:** 
> Typographical consistency: The error message 'failed to marshal Api Monitoring filters' uses 'Api' with a lowercase 'p' while other similar keys and messages use lower-case (e.g. 'api_monitoring') or upper-case consistently. Consider using consistent capitalization (e.g. 'API Monitoring' or 'api_monitoring') to improve clarity.
> - **Reason this comment was not posted:**
> Comment was not on a location in the diff, so it can't be submitted as a review comment.
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_onslJ3NqnIBDlICG`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T08:53:19Z
user: login: vikrantgupta25
state: CHANGES_REQUESTED
author_association: MEMBER
submitted_at: 2025-05-12T09:20:15Z
user: login: eKuG
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T09:23:19Z
user: login: eKuG
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T09:23:49Z
user: login: eKuG
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T09:29:33Z
user: login: ellipsis-dev[bot]
body: > [!IMPORTANT]
> **Looks good to me!  :+1:**
> <details>
> <summary>Reviewed d421e40f0bb11d052f151b0a5debc715713510b9 in <ellipsistime>1 minute and 45 seconds</ellipsistime>. Click for details.</summary> 
> 
> - Reviewed `16` lines of code in `1` files
> - Skipped `0` files when reviewing.
> - Skipped posting `2` draft comments. View those below.
> - Modify your [settings](https://app.ellipsis.dev/SigNoz/settings/code-review) and [rules](https://app.ellipsis.dev/SigNoz/code-review/rules) to customize what types of comments Ellipsis leaves. And don't forget to react with :+1: or :-1: to teach Ellipsis.
> 
> <details>
> <summary>1. <code>pkg/sqlmigration/031_update_quick_filters.go:95</code></summary>
> 
> - **Draft comment:** 
> Good improvement on checking commit error explicitly. Consider wrapping the commit error with context to aid debugging if commit fails.
> - **Reason this comment was not posted:**
> Confidence changes required: `33%` <= threshold `50%` None
> 
> 
> </details>
> 
> <details>
> <summary>2. <code>pkg/sqlmigration/031_update_quick_filters.go:95</code></summary>
> 
> - **Draft comment:** 
> The explicit error check on tx.Commit() (lines 95-98) is functionally equivalent to simply "return tx.Commit()". Consider reverting to the concise form unless you plan to add additional error handling/logging.
> - **Reason this comment was not posted:**
> Decided after close inspection that this draft comment was likely wrong and/or not actionable: usefulness confidence = 10% vs. threshold = 50% The comment is technically correct - `return tx.Commit()` would have the same functional behavior as the current code. However, the explicit error check pattern is a valid and common style that some teams prefer for clarity and debugging. The change suggested is purely stylistic and doesn't improve code quality or fix any actual issues. The explicit error handling could be more maintainable if logging needs to be added later. The current style is also more consistent with other error handling in the file. While the suggestion is technically correct, the current style is valid and may be preferred for consistency and future maintainability. This comment should be deleted as it suggests a purely stylistic change that doesn't improve code quality and is just a matter of preference.
> 
> 
> </details>
> 
> 
> Workflow ID: <workflowid>`wflow_zWrJ6A2a6J80WbKF`</workflowid>
> </details>
> 
> <sup>You can customize </sup>[<img alt="Ellipsis" src="https://img.shields.io/badge/Ellipsis-blue?color=175173">](https://www.ellipsis.dev?ref=SigNoz%2Fsignoz&utm_source=github&utm_medium=referral)<sup> by changing your [verbosity settings](https://app.ellipsis.dev/SigNoz/settings/code-review), reacting with :+1: or :-1:, [replying to comments](https://docs.ellipsis.dev/features/code-review#teaching-ellipsis), or adding [code review rules](https://app.ellipsis.dev/SigNoz/code-review/rules).</sup>
state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-05-12T09:32:08Z
user: login: vikrantgupta25
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-12T09:58:41Z
user: login: therealpandey
state: APPROVED
author_association: MEMBER
submitted_at: 2025-05-12T10:37:56Z

Review comments:
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newResetQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newResetQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: ellipsis-dev[bot]
body: Consider renaming `newResetQuickFilters` to `newUpdateQuickFilters` for consistency with the migration name.

created_at: 2025-05-11T17:23:16Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: vikrantgupta25
body: why is this where clause required ? 
created_at: 2025-05-12T09:16:27Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
+		Exec(ctx)
+	if err != nil {
+		return err
+	}
+
+	// Get all organization IDs as strings
+	var orgIDs []string
+	err = tx.NewSelect().
+		Table("organizations").
+		Column("id").
+		Scan(ctx, &orgIDs)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			// No organizations found, commit the transaction (deletion is done) and return
+			if err := tx.Commit(); err != nil {
+				return err
+			}
+			return nil
+		}
+		return err
+	}
+
+	// For each organization, create new quick filters with the updated NewDefaultQuickFilter function
+	for _, orgID := range orgIDs {
+		// Get the updated default quick filters
+		storableQuickFilters, err := quickfiltertypes.NewDefaultQuickFilter(valuer.MustNewUUID(orgID))
+		if err != nil {
+			return err
+		}
+
+		// Insert all filters for this organization
+		_, err = tx.NewInsert().
+			Model(&storableQuickFilters).
+			Exec(ctx)
+
+		if err != nil {
+			if errors.Ast(migration.store.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "Quick Filter already exists"), errors.TypeAlreadyExists) {
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: vikrantgupta25
body: why is this check required when already we are dropping all the data before the migration 
created_at: 2025-05-12T09:19:28Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
+		Exec(ctx)
+	if err != nil {
+		return err
+	}
+
+	// Get all organization IDs as strings
+	var orgIDs []string
+	err = tx.NewSelect().
+		Table("organizations").
+		Column("id").
+		Scan(ctx, &orgIDs)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			// No organizations found, commit the transaction (deletion is done) and return
+			if err := tx.Commit(); err != nil {
+				return err
+			}
+			return nil
+		}
+		return err
+	}
+
+	// For each organization, create new quick filters with the updated NewDefaultQuickFilter function
+	for _, orgID := range orgIDs {
+		// Get the updated default quick filters
+		storableQuickFilters, err := quickfiltertypes.NewDefaultQuickFilter(valuer.MustNewUUID(orgID))
+		if err != nil {
+			return err
+		}
+
+		// Insert all filters for this organization
+		_, err = tx.NewInsert().
+			Model(&storableQuickFilters).
+			Exec(ctx)
+
+		if err != nil {
+			if errors.Ast(migration.store.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "Quick Filter already exists"), errors.TypeAlreadyExists) {
+				// Skip if filters already exist for this org
+				continue
+			}
+			return err
+		}
+	}
+
+	return tx.Commit()
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: vikrantgupta25
body: follow the same pattern as in line 65. you can use both of them but decide on one and then use it everywhere 
created_at: 2025-05-12T09:20:06Z
author_association: MEMBER
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
+		Exec(ctx)
+	if err != nil {
+		return err
+	}
+
+	// Get all organization IDs as strings
+	var orgIDs []string
+	err = tx.NewSelect().
+		Table("organizations").
+		Column("id").
+		Scan(ctx, &orgIDs)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			// No organizations found, commit the transaction (deletion is done) and return
+			if err := tx.Commit(); err != nil {
+				return err
+			}
+			return nil
+		}
+		return err
+	}
+
+	// For each organization, create new quick filters with the updated NewDefaultQuickFilter function
+	for _, orgID := range orgIDs {
+		// Get the updated default quick filters
+		storableQuickFilters, err := quickfiltertypes.NewDefaultQuickFilter(valuer.MustNewUUID(orgID))
+		if err != nil {
+			return err
+		}
+
+		// Insert all filters for this organization
+		_, err = tx.NewInsert().
+			Model(&storableQuickFilters).
+			Exec(ctx)
+
+		if err != nil {
+			if errors.Ast(migration.store.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "Quick Filter already exists"), errors.TypeAlreadyExists) {
+				// Skip if filters already exist for this org
+				continue
+			}
+			return err
+		}
+	}
+
+	return tx.Commit()
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: eKuG
body: Ack
created_at: 2025-05-12T09:23:19Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
+		Exec(ctx)
+	if err != nil {
+		return err
+	}
+
+	// Get all organization IDs as strings
+	var orgIDs []string
+	err = tx.NewSelect().
+		Table("organizations").
+		Column("id").
+		Scan(ctx, &orgIDs)
+	if err != nil {
+		if err == sql.ErrNoRows {
+			// No organizations found, commit the transaction (deletion is done) and return
+			if err := tx.Commit(); err != nil {
+				return err
+			}
+			return nil
+		}
+		return err
+	}
+
+	// For each organization, create new quick filters with the updated NewDefaultQuickFilter function
+	for _, orgID := range orgIDs {
+		// Get the updated default quick filters
+		storableQuickFilters, err := quickfiltertypes.NewDefaultQuickFilter(valuer.MustNewUUID(orgID))
+		if err != nil {
+			return err
+		}
+
+		// Insert all filters for this organization
+		_, err = tx.NewInsert().
+			Model(&storableQuickFilters).
+			Exec(ctx)
+
+		if err != nil {
+			if errors.Ast(migration.store.WrapAlreadyExistsErrf(err, errors.CodeAlreadyExists, "Quick Filter already exists"), errors.TypeAlreadyExists) {
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: eKuG
body: Its precautionary 

created_at: 2025-05-12T09:23:49Z
author_association: CONTRIBUTOR
diff_hunk: @@ -0,0 +1,100 @@
+package sqlmigration
+
+import (
+	"context"
+	"database/sql"
+	"github.com/SigNoz/signoz/pkg/errors"
+	"github.com/SigNoz/signoz/pkg/factory"
+	"github.com/SigNoz/signoz/pkg/sqlstore"
+	"github.com/SigNoz/signoz/pkg/types/quickfiltertypes"
+	"github.com/SigNoz/signoz/pkg/valuer"
+	"github.com/uptrace/bun"
+	"github.com/uptrace/bun/migrate"
+)
+
+type updateQuickFilters struct {
+	store sqlstore.SQLStore
+}
+
+func NewUpdateQuickFiltersFactory(store sqlstore.SQLStore) factory.ProviderFactory[SQLMigration, Config] {
+	return factory.NewProviderFactory(factory.MustNewName("update_quick_filters"), func(ctx context.Context, ps factory.ProviderSettings, c Config) (SQLMigration, error) {
+		return newUpdateQuickFilters(ctx, ps, c, store)
+	})
+}
+
+func newUpdateQuickFilters(_ context.Context, _ factory.ProviderSettings, _ Config, store sqlstore.SQLStore) (SQLMigration, error) {
+	return &updateQuickFilters{
+		store: store,
+	}, nil
+}
+
+func (migration *updateQuickFilters) Register(migrations *migrate.Migrations) error {
+	if err := migrations.Register(migration.Up, migration.Down); err != nil {
+		return err
+	}
+
+	return nil
+}
+
+func (migration *updateQuickFilters) Up(ctx context.Context, db *bun.DB) error {
+	tx, err := db.BeginTx(ctx, nil)
+	if err != nil {
+		return err
+	}
+
+	defer tx.Rollback()
+
+	// Delete all existing quick filters
+	_, err = tx.NewDelete().
+		Table("quick_filter").
+		Where("1=1"). // Delete all rows
path: pkg/sqlmigration/031_update_quick_filters.go
user: login: eKuG
body: "bun: Update and Delete queries require at least one Where"

^Thats why we have used "Where"
created_at: 2025-05-12T09:29:33Z
author_association: CONTRIBUTOR

PR comments:
user: login: therealpandey
created_at: 2025-05-08T07:03:19Z
body: @eKuG you also need to think about those users for whom the defaults have already been created.
author_association: MEMBER
user: login: eKuG
created_at: 2025-05-08T07:05:05Z
body: > @eKuG you also need to think about those users for whom the defaults have already been created.

Yes I know, I'm still thinking whether it will affect them or not? Can we handle it or not? Otherwise I'll add an update migration script. @grandwizard28 
author_association: CONTRIBUTOR
user: login: eKuG
created_at: 2025-05-12T06:33:30Z
body: @grandwizard28 you can review now
author_association: CONTRIBUTOR
user: login: therealpandey
created_at: 2025-05-12T07:31:57Z
body: Approved for types @vikrantgupta25 
author_association: MEMBER