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: update heartbeat, language event and add serviceName event #4571

Merged
merged 4 commits into from
Feb 21, 2024

Conversation

makeavish
Copy link
Member

@makeavish makeavish commented Feb 19, 2024

Summary

  • Update heartbeat and language events functions to use heartbeat interval
  • Update samples and ts event queries to discard span metrics generated by span metrics processor
  • Update active user event to check for metrics in last active user interval
  • Add new event ServiceName which emits service names in last heartbeat interval

Summary by CodeRabbit

  • New Features
    • Added functionality to retrieve total counts of logs and samples.
    • Enhanced querying capabilities for spans, samples, logs, and tags within specific time intervals, improving data retrieval precision.
    • Introduced new telemetry event for services, allowing for more detailed analytics based on service-related metrics and logs.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the chore label Feb 19, 2024
Copy link

coderabbitai bot commented Feb 19, 2024

Walkthrough

The recent updates enhance the query service's capability to handle telemetry data more flexibly. By introducing new methods and modifying existing ones, the service can now query logs, samples, spans, and tags over specific intervals, improving data retrieval efficiency. Additionally, the telemetry system has been refined to better capture and report on service-related metrics, ensuring a more comprehensive understanding of system performance and user interactions.

Changes

Files Changes
.../clickhouseReader/reader.go - New methods for total logs and samples count.
- Modified methods to accept interval for querying.
- Added functionality to populate services in tags info response.
.../interfaces/interface.go - Added time import.
- Renamed and added methods for interval-based querying.
- Updated methods to include interval parameter.
.../telemetry/telemetry.go - New TELEMETRY_EVENT_SERVICE constant.
- Updated SAAS_EVENTS_LIST to include new event.
- Modified createTelemetry function for enhanced metrics and logs handling based on user and heartbeat duration.

🐰✨
In the realm of code, where data streams flow,
A rabbit hopped in, with changes in tow.
Spans, logs, and samples, now queried with grace,
Through intervals of time, they now chase.
Telemetry refined, with services in sight,
Ensuring the metrics, are captured just right.
🌟📊

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.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@makeavish makeavish marked this pull request as ready for review February 19, 2024 04:28
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

2 similar comments
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

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

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between e2669eb and a31c2e8.
Files selected for processing (3)
  • pkg/query-service/app/clickhouseReader/reader.go (6 hunks)
  • pkg/query-service/interfaces/interface.go (2 hunks)
  • pkg/query-service/telemetry/telemetry.go (7 hunks)
Additional comments: 10
pkg/query-service/interfaces/interface.go (5)
  • 5-5: The addition of the time package import is appropriate given the introduction of methods that require a time.Duration parameter. This change is necessary for the functionality being introduced and follows best practices for handling time-based operations in Go.
  • 78-78: The method GetTotalLogs has been correctly renamed and now returns a uint64 and an error, which is a standard approach for methods that perform operations which might fail. This change aligns with Go's idiomatic error handling.
  • 79-79: The addition of the GetTotalSamples method is consistent with the objective of enhancing telemetry data collection capabilities. Returning a uint64 and an error is appropriate for the expected functionality.
  • 80-80: The modification of GetSpansInLastHeartBeatInterval to include an interval parameter of type time.Duration is logical and necessary for the intended functionality of querying spans within a specific time interval. This change improves the method's flexibility and utility.
  • 82-84: The updates to GetSamplesInfoInLastHeartBeatInterval, GetLogsInfoInLastHeartBeatInterval, and GetTagsInfoInLastHeartBeatInterval methods to include an interval parameter of type time.Duration are consistent with the objective of enhancing query capabilities based on specific time intervals. These changes are correctly implemented and follow best practices for handling time-based operations in Go.
pkg/query-service/telemetry/telemetry.go (4)
  • 38-38: The addition of the TELEMETRY_EVENT_SERVICE constant is correctly implemented and follows Go's naming conventions for constants. This change is necessary for the new functionality being introduced.
  • 55-55: Updating the SAAS_EVENTS_LIST map to include the TELEMETRY_EVENT_SERVICE constant is appropriate and necessary for the new telemetry event handling. This change ensures that the new event type is recognized and processed correctly.
  • 235-237: The loop that sends the TELEMETRY_EVENT_SERVICE event for each service found in tagsInfo.Services is correctly implemented. This approach allows for the emission of service-specific telemetry events, enhancing the granularity of the telemetry data collected.
  • 288-288: The conditional check to send the TELEMETRY_EVENT_DASHBOARDS_ALERTS event only if there are dashboards or alerts is a good practice. It avoids unnecessary event emissions when there is no relevant data to report, which can help in optimizing the telemetry data collection process.
pkg/query-service/app/clickhouseReader/reader.go (1)
  • 3365-3368: The method GetTotalSamples retrieves the total count of samples excluding those with a metric name starting with 'signoz_'. This is a straightforward query, but it's important to ensure that the metric name filter ('signoz_%') correctly captures all intended cases and doesn't inadvertently exclude relevant data. Additionally, consider the performance impact of this query on large datasets and whether any optimizations or indexes could improve its efficiency.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

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 a31c2e8 and 17415ce.
Files selected for processing (1)
  • pkg/query-service/model/response.go (1 hunks)

pkg/query-service/model/response.go Show resolved Hide resolved
Copy link
Member

@prashant-shahi prashant-shahi left a comment

Choose a reason for hiding this comment

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

Had a code walk-through with @makeavish - approving on request

@makeavish makeavish merged commit 0cb60e1 into develop Feb 21, 2024
11 of 12 checks passed
@makeavish makeavish deleted the chore/update-telemetry branch February 21, 2024 09:19
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

2 participants