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: bug fix for the issue in span filtering feature. No spans returned in traces tab #7023

Merged
merged 2 commits into from
Feb 4, 2025

Conversation

eKuG
Copy link
Contributor

@eKuG eKuG commented Feb 4, 2025

Summary

Fixed a bug where no traces are returned in the traces tab.
Refer : https://signoz-team.slack.com/archives/C089D1B5516/p1738552174171329

Related Issues / PR's

Screenshots

NA

Affected Areas and Manually Tested Areas


Important

Fixes span filtering bug in traces tab by adjusting SQL query construction and handling of GLOBAL IN clauses.

  • Behavior:
    • Fixes span filtering bug in traces tab by adjusting SQL query construction in query_builder.go.
    • Ensures correct handling of GLOBAL IN clause for span search scope attributes.
    • Adjusts limit and offset handling in buildTracesQuery().
  • SQL Queries:
    • Modifies TracesExplorerViewSQLSelectWithSubQuery and TracesExplorerViewSQLSelectAfterSubQuery in constants.go to correct query limits.
    • Updates buildSpanScopeQuery() to use GLOBAL IN for entry point spans.
  • Tests:
    • Updates test cases in query_builder_test.go and query_builder_test.go to reflect query changes and ensure correct behavior.
    • Adds tests for handling of GLOBAL IN and query limits.

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

@eKuG eKuG requested a review from nityanandagohain February 4, 2025 12:42
@github-actions github-actions bot added bug Something isn't working enhancement New feature or request labels Feb 4, 2025
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.

❌ Changes requested. Reviewed everything up to 2eb805f in 2 minutes and 12 seconds

More details
  • Looked at 72 lines of code in 3 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. pkg/query-service/app/traces/v4/query_builder_test.go:568
  • Draft comment:
    The expected query strings in tests have been updated with 'GLOBAL IN' and additional limits on offset processing. Verify that these expected strings accurately reflect ClickHouse syntax and that any future changes in query building logic also update these tests accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. pkg/query-service/constants/constants.go:710
  • Draft comment:
    The merging of new and deprecated static trace fields using maps.Clone and maps.Copy is clever; however, a brief comment explaining why both sets are merged (and how deprecated fields are intended to be phased out) could benefit future maintainers.
  • 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.
3. pkg/query-service/constants/constants.go:36
  • Draft comment:
    Using testing.Testing() here to detect test mode is non‐standard and may be unreliable. Consider using a more explicit mechanism (e.g. a dedicated environment variable or build tag) instead.
  • 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.
4. pkg/query-service/constants/constants.go:243
  • Draft comment:
    In GetOrDefaultEnv, consider trimming the value returned by os.Getenv to avoid issues with unintended leading/trailing whitespace. For example, use strings.TrimSpace on the fetched value.
  • 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.
5. pkg/query-service/constants/constants.go:709
  • Draft comment:
    In the init() function, the merge of NewStaticFieldsTraces with DeprecatedStaticFieldsTraces using maps.Clone and maps.Copy is not self‐documenting. Consider adding a comment to explain the rationale behind merging the deprecated fields to aid future maintainers.
  • 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.
6. pkg/query-service/constants/constants.go:325
  • Draft comment:
    Review the spacing in these SQL query string constants. For example, TracesExplorerViewSQLSelectWithSubQuery lacks a trailing space, which might affect query string concatenation. Verify that all fragments have appropriate spacing.
  • Reason this comment was not posted:
    Comment did not seem useful.

Workflow ID: wflow_yVcDUl8F4XhnUaAx


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

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! Incremental review on 0a240e6 in 36 seconds

More details
  • Looked at 17 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 9 drafted comments based on config settings.
1. pkg/query-service/app/traces/v3/query_builder_test.go:11
  • Draft comment:
    Consider splitting this very large test file into smaller, focused test files for improved maintainability and faster feedback.
  • 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.
2. pkg/query-service/app/traces/v3/query_builder_test.go:507
  • Draft comment:
    Long SQL query strings are built with concatenations; consider using raw string literals (backticks) to improve readability.
  • 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.
3. pkg/query-service/app/traces/v3/query_builder_test.go:1195
  • Draft comment:
    Using 'ShouldEqual' for SQL string comparisons can be brittle due to whitespace differences; consider normalizing whitespace or using a more robust comparison.
  • 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.
4. pkg/query-service/app/traces/v3/query_builder_test.go:1124
  • Draft comment:
    Ensure concatenated SQL parts include consistent spacing; missing spaces during concatenation can lead to unexpected query errors.
  • 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.
5. pkg/query-service/app/traces/v3/query_builder_test.go:1160
  • Draft comment:
    Consider adding comments or helper methods for constructing expected queries to reduce duplication and improve clarity in test cases.
  • 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.
6. pkg/query-service/app/traces/v3/query_builder_test.go:507
  • Draft comment:
    Consider using raw string literals (backticks) for the expected SQL query strings instead of string concatenation. This will improve readability and reduce potential errors.
  • 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.
7. pkg/query-service/app/traces/v3/query_builder_test.go:1195
  • Draft comment:
    Using an exact string comparison (ShouldEqual) for SQL queries can be brittle. Consider normalizing or using a more flexible matcher to compare logical query equivalence.
  • 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.
8. pkg/query-service/app/traces/v3/query_builder_test.go:497
  • Draft comment:
    The test cases use hard-coded timestamp values which could be extracted into constants. This would improve clarity and ease future maintenance.
  • 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.
9. pkg/query-service/app/traces/v3/query_builder_test.go:1200
  • Draft comment:
    Consider refactoring repeated SQL query components in the expected query strings into helper functions or variables to reduce duplication and simplify future modifications.
  • 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.

Workflow ID: wflow_jXp2RWaDcACeCFlx


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

@nityanandagohain nityanandagohain merged commit 01b6e22 into main Feb 4, 2025
17 checks passed
@nityanandagohain nityanandagohain deleted the spanFilterBugFix branch February 4, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working docs shipped enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants