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(promexporter): add some tracing #3114

Merged
merged 3 commits into from
Sep 10, 2024
Merged

feat(promexporter): add some tracing #3114

merged 3 commits into from
Sep 10, 2024

Conversation

golangisfun123
Copy link
Collaborator

@golangisfun123 golangisfun123 commented Sep 9, 2024

Description
A clear and concise description of the features you're adding in this pull request.

Additional context
Add any other context about the problem you're solving.

Metadata

  • Fixes #[Link to Issue]

Summary by CodeRabbit

  • New Features

    • Enhanced error handling and tracing capabilities during metric collection.
    • Introduced a new helper function for consolidating multiple error messages.
  • Improvements

    • Updated context management for better tracking of metric collection events.
    • Improved clarity of error reporting by aggregating error messages into a single overview.

Copy link

cloudflare-workers-and-pages bot commented Sep 9, 2024

Deploying sanguine-fe with  Cloudflare Pages  Cloudflare Pages

Latest commit: 24e9f79
Status: ✅  Deploy successful!
Preview URL: https://5e420c51.sanguine-fe.pages.dev
Branch Preview URL: https://promexporter-tracing.sanguine-fe.pages.dev

View logs

Copy link
Contributor

coderabbitai bot commented Sep 9, 2024

Walkthrough

The pull request modifies the collectMetrics function in the exporter struct to improve error handling and tracing. The function now accepts a parentCtx parameter, enhancing context management. A tracing span is initiated to track events and errors during metric collection, with a new helper function, combineErrors, introduced to aggregate error messages. These changes aim to provide better insights into the function's execution and improve error reporting clarity.

Changes

File Change Summary
contrib/promexporter/exporters/exporter.go Modified collectMetrics function signature and added combineErrors helper function.

Suggested labels

go, size/s

Poem

In the meadow where metrics play,
A rabbit hops with joy today.
Errors gathered, now combined,
Tracing paths, all well-defined.
With each hop, the data sings,
A clearer view of all the things! 🐇✨


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 testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added go Pull requests that update Go code size/xs labels Sep 9, 2024
Copy link

codecov bot commented Sep 9, 2024

Codecov Report

Attention: Patch coverage is 0% with 21 lines in your changes missing coverage. Please review.

Project coverage is 43.76083%. Comparing base (b27643f) to head (24e9f79).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
contrib/promexporter/exporters/exporter.go 0.00000% 21 Missing ⚠️
Additional details and impacted files
@@                 Coverage Diff                  @@
##              master       #3114          +/-   ##
====================================================
- Coverage   90.56974%   43.76083%   -46.80891%     
====================================================
  Files             54          74          +20     
  Lines           1018        2308        +1290     
  Branches          82          82                  
====================================================
+ Hits             922        1010          +88     
- Misses            93        1292        +1199     
- Partials           3           6           +3     
Flag Coverage Δ
packages 90.56974% <ø> (ø)
promexporter 6.82171% <0.00000%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@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.

Actionable comments posted: 0

Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 9a6bd0b and 663b52d.

Files selected for processing (1)
  • contrib/promexporter/exporters/exporter.go (4 hunks)
Additional comments not posted (4)
contrib/promexporter/exporters/exporter.go (4)

123-129: Improved context management and tracing.

The changes to the collectMetrics function signature and the addition of the tracing span enhance the context management and tracing capabilities of the function. The combineErrors function is expected to aggregate errors collected during the function execution, providing clearer error reporting.

These changes align with the PR objective of improving tracing and error handling.


133-133: Enhanced tracing with error-specific events.

The addition of tracing events within the existing error handling blocks provides more granular insights into the function's execution flow. These events capture specific error occurrences related to fetching relayer balances and getting token balances, helping identify and diagnose issues more effectively.

The changes align with the PR objective of enhancing tracing capabilities.

Also applies to: 138-138


146-146: Enhanced tracing within loops.

The addition of tracing events within the existing loops provides more granular insights into the function's execution flow. These events capture error occurrences related to getting stuck hero count, submitter stats, and vprice stats, helping identify and diagnose issues more effectively within the loops.

The changes align with the PR objective of enhancing tracing capabilities.

Also applies to: 155-155, 170-170


174-174: Improved error handling and reporting.

The addition of the tracing event when metrics collection fails provides a high-level indication of the failure, complementing the more granular error events captured earlier in the function.

The introduction of the combineErrors function enhances the clarity of error reporting by consolidating multiple error messages into a single error. This makes it easier to understand the overall failure and aligns with the PR objective of improving error handling and reporting.

The implementation of combineErrors is straightforward and effective, checking for the presence of errors in the input slice and joining their messages into a single string to create a new error with the combined message.

Also applies to: 181-194

@trajan0x trajan0x merged commit 7eb0413 into master Sep 10, 2024
41 of 43 checks passed
@trajan0x trajan0x deleted the promexporter-tracing branch September 10, 2024 07:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code size/xs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants