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

Add support for ExponentialHistogram #279

Merged
merged 3 commits into from
Feb 10, 2024
Merged

Add support for ExponentialHistogram #279

merged 3 commits into from
Feb 10, 2024

Conversation

srikanthccv
Copy link
Member

@srikanthccv srikanthccv commented Feb 4, 2024

So there can be at least some non-trivial stuff in launch week.

It is built on top of SigNoz/ch-go#1 and SigNoz/clickhouse-go#1. The detail of the sketch is too broad to put into the PR description. If you want to test it out, please run https://gist.github.com/srikanthccv/d046e2b677a5c03c29782cc9f8e179f1.

SELECT arrayMap(a -> round(a, 2), (quantilesDDMerge(0.01, 0.42, 0.69, 0.75, 0.9, 0.95, 0.99)(sketch)))
FROM signoz_metrics.exp_hist
WHERE unix_milli <= toUnixTimestamp(now() - INTERVAL 1 MINUTE) * 1000

Summary by CodeRabbit

  • New Features
    • Introduced support for exponential histogram metrics, including complex data processing and storage.
    • Added new tables for storing exponential histogram metrics, enhancing the app's data handling capabilities.
  • Improvements
    • Improved handling and processing of exponential histogram data points, ensuring accurate and efficient data representation.
  • Database Changes
    • Implemented new SQL migrations for creating and dropping tables related to exponential histogram metrics.

Copy link

coderabbitai bot commented Feb 4, 2024

Walkthrough

The recent changes introduce enhanced support for exponential histograms in the ClickHouse metrics exporter. Key updates include the ability to process and write complex exponential histogram data to new tables, improved handling of metric types, and the addition of specific SQL migrations for managing the necessary database schema changes. This update aims at better data representation and processing efficiency for exponential histograms within the metrics system.

Changes

Files Summary
.../clickhouse.go Added chproto import, a new constant, and functionality for writing to DISTRIBUTED_EXP_HIST_TABLE.
.../exporter.go Introduced support for MetricTypeExponentialHistogram, handling its aggregation and data points processing.
.../helper.go Added functions for exponential histogram handling and processing, with enhanced logic and calculations.
.../metrics/migrations/000007_exp_hist.down.sql
.../metrics/migrations/000007_exp_hist.up.sql
SQL migrations for creating and dropping exp_hist and distributed_exp_hist tables.

🐇✨
In a land of data, vast and wide,
A rabbit hopped with a skilled stride.
Histograms exponential, now neatly stored,
Through tables and metrics, our data soared.
🎉📊

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.

@srikanthccv
Copy link
Member Author

Once this is merged, I will add the instrumentation for signoz_latency with this new type and test the effectiveness. The fixed bucket histogram will still be there.

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: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between adb5367 and ca7495e.
Files ignored due to path filters (2)
  • go.mod is excluded by: !**/*.mod
  • go.sum is excluded by: !**/*.sum
Files selected for processing (5)
  • exporter/clickhousemetricsexporter/clickhouse.go (3 hunks)
  • exporter/clickhousemetricsexporter/exporter.go (2 hunks)
  • exporter/clickhousemetricsexporter/helper.go (1 hunks)
  • migrationmanager/migrators/metrics/migrations/000007_exp_hist.down.sql (1 hunks)
  • migrationmanager/migrators/metrics/migrations/000007_exp_hist.up.sql (1 hunks)
Additional comments: 8
migrationmanager/migrators/metrics/migrations/000007_exp_hist.down.sql (1)
  • 1-3: LGTM.
migrationmanager/migrators/metrics/migrations/000007_exp_hist.up.sql (1)
  • 1-19: LGTM.
exporter/clickhousemetricsexporter/exporter.go (2)
  • 189-190: LGTM.
  • 261-276: LGTM.
exporter/clickhousemetricsexporter/clickhouse.go (2)
  • 55-55: LGTM.
  • 496-576: LGTM.
exporter/clickhousemetricsexporter/helper.go (2)
  • 489-510: LGTM.
  • 512-553: LGTM.

@srikanthccv
Copy link
Member Author

I am going to merge this since there is less context known to the reviewer. The tl;dr version is that the sketch maintains a maximum of 1024 buckets with bins/buckets laid out in such a way that relative error is honoured. The buckets are multiples of powers of 2, and that makes it possible to merge the sketches by reducing the scale of high precision sketch to low precision sketch. I will be happy to answer questions anytime https://www.vldb.org/pvldb/vol12/p2195-masson.pdf

@srikanthccv srikanthccv merged commit 0485ef8 into main Feb 10, 2024
2 checks passed
@srikanthccv srikanthccv deleted the exp-histo branch February 10, 2024 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant