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

chore: add ExponentialHistogram support for metrics v4 query range #4525

Merged
merged 3 commits into from
Feb 14, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Feb 11, 2024

Summary

Part of #4016

Although this was not originally planned for, we have all the pieces in place to support it. This doesn't require any additional work from the frontend.

Related and depends on SigNoz/signoz-otel-collector#288

Summary by CodeRabbit

  • New Features
    • Introduced support for multiple quantiles in metrics queries.
    • Enhanced metrics query capabilities with dynamic table selection and special handling for percentile aggregations.
    • Added new metric types including Sum, Gauge, Histogram, Summary, and ExponentialHistogram.
  • Refactor
    • Simplified code by consolidating functions related to grouping and ordering by attribute keys.
  • Tests
    • Added a new test case for time series query preparation.

Copy link

coderabbitai bot commented Feb 11, 2024

Walkthrough

This update introduces enhancements and optimizations across the query service, particularly focusing on time series data handling. It adds support for multiple quantiles, dynamic table selection, and special handling for different metric types including percentile aggregations. Additionally, it streamlines the code by consolidating similar functions, improving code maintainability. The introduction of new MetricType constants further clarifies the handling of various metric data types.

Changes

Files Summary
.../metrics/v4/delta/time_series_test.go
.../metrics/v4/delta/timeseries.go
Added new test case for time series query preparation and enhanced timeseries.go with support for multiple quantiles, dynamic table selection, and special handling for percentile and exphist type metrics.
.../metrics/v4/helpers/clauses.go Simplified the codebase by consolidating GroupByAttributeKeyTags and OrderByAttributeKeyTags functions, removing redundant ones.
.../model/v3/v3.go Introduced new MetricType constants for diverse metric types like Sum, Gauge, Histogram, Summary, and ExponentialHistogram.

🏈🐇 A rabbit hopped onto the field, where Chiefs and Niners fiercely wielded,
In a game of might and wit, where every play is a hit.
"May the best team win," it said, with a grin,
"For in this game, we're all kin."
With a leap and a cheer, the rabbit disappeared,
Leaving behind a spirit, so revered.
🎉🐾 Let the Super Bowl be a joy, for every girl and boy!

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the chore label Feb 11, 2024
@srikanthccv srikanthccv marked this pull request as ready for review February 11, 2024 16:13
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 3b98073 and be4b851.
Files ignored due to path filters (2)
  • deploy/docker-swarm/clickhouse-setup/otel-collector-config.yaml is excluded by: !**/*.yaml
  • deploy/docker/clickhouse-setup/otel-collector-config.yaml is excluded by: !**/*.yaml
Files selected for processing (4)
  • pkg/query-service/app/metrics/v4/delta/time_series_test.go (1 hunks)
  • pkg/query-service/app/metrics/v4/delta/timeseries.go (5 hunks)
  • pkg/query-service/app/metrics/v4/helpers/clauses.go (2 hunks)
  • pkg/query-service/model/v3/v3.go (1 hunks)
Additional comments: 6
pkg/query-service/app/metrics/v4/helpers/clauses.go (1)
  • 37-42: > 📝 NOTE

This review was outside the diff hunks and was mapped to the diff hunk with the greatest overlap. Original lines [1-49]

The consolidation of GroupByAttributeKeyTagsWithoutLe and OrderByAttributeKeyTagsWithoutLe into GroupByAttributeKeyTags and OrderByAttributeKeyTags is not directly visible in the provided code. Ensure that the consolidated functions correctly handle all cases previously covered by the removed functions, including any special handling for the le attribute if applicable.

pkg/query-service/app/metrics/v4/delta/timeseries.go (4)
  • 12-15: The sketchFmt variable is updated to support multiple quantiles. Verify that the format string is correctly used in all relevant places and that it properly handles multiple quantile values.
  • 92-95: The dynamic selection of the table name based on mq.AggregateAttribute.Type introduces a special case for exphist type metrics. Ensure that this logic is correctly applied in all relevant query preparation functions and that the table name distributed_exp_hist is correctly configured in the database schema.
  • 122-128: The handling for percentile aggregations using the sketchFmt variable is introduced. Ensure that the percentile values are correctly calculated and applied in the query, and that the sketchFmt variable is used correctly with the appropriate quantile values.
  • 214-216: The special case for exphist type metrics in canShortCircuit function is added. Verify that this logic correctly identifies scenarios where the optimized query can be used for exphist metrics and that it does not inadvertently affect other metric types or aggregation scenarios.
pkg/query-service/model/v3/v3.go (1)
  • 492-501: The addition of new MetricType constants expands the model to include various types of metrics, including ExponentialHistogram. Ensure that these new types are correctly used throughout the codebase and that their inclusion does not introduce inconsistencies or errors in metric processing or representation.

@srikanthccv
Copy link
Member Author

Reviews please.

@srikanthccv srikanthccv merged commit f734142 into develop Feb 14, 2024
11 checks passed
@srikanthccv srikanthccv deleted the 4016-11-exphist branch February 14, 2024 18:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants