Refactor report() to use keyword arguments with predefined units#3
Merged
nateberkopec merged 3 commits intomainfrom Nov 1, 2025
Merged
Refactor report() to use keyword arguments with predefined units#3nateberkopec merged 3 commits intomainfrom
nateberkopec merged 3 commits intomainfrom
Conversation
Changes the report() method signature from positional arguments to a hash-based approach where the metric name is the key. The method now automatically looks up the integration based on the metric name from the config, eliminating the need to pass it explicitly. Dimensions can be provided as a hash for cleaner syntax. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Changes the report() method to use proper keyword arguments: - metric: (required symbol) - value: (required) - dimensions: (optional hash) - namespace: (optional string) Units are now predefined in configuration and cannot be overridden. Each metric has a fixed unit that is automatically applied based on the metric name. Added unit mappings to Configuration for all metrics (Count, Seconds, Milliseconds, Percent). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
Simplifies dimension handling by requiring dimensions to always be a hash. Removes the convert_dimensions method and the unnecessary conditional logic for handling arrays or other types. Dimensions are now always expected as a hash and converted inline. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactors the
report()method to use proper keyword arguments with a cleaner signature:Before:
After:
Changes
New Signature
metric:- Required symbol for the metric namevalue:- Required value for the metricdimensions:- Optional hash of dimensions (no more array of hashes!)namespace:- Optional string to override the default namespacePredefined Units
Units are now predefined in the configuration and cannot be overridden. Each metric has a fixed unit that is automatically applied:
Workers,EnqueuedJobs,QueueSize, etc.QueueLatency(Seconds),RequestQueueTime(Milliseconds)UtilizationThis ensures consistency and prevents accidental misuse of units.
Implementation Details
unitsconfiguration hash toConfigurationclass mapping each metric to its unitMetricReporter#reportto use proper kwargs signatureBenefits
Test Plan
🤖 Generated with Claude Code