Remove scales dependency with self-contained metrics implementation#681
Merged
dkropachev merged 2 commits intomasterfrom Feb 2, 2026
Merged
Remove scales dependency with self-contained metrics implementation#681dkropachev merged 2 commits intomasterfrom
dkropachev merged 2 commits intomasterfrom
Conversation
d2d6b18 to
9e60f4e
Compare
The scales library had its last release in 2015 and was only tested on Python 2.7/3.3. This change replaces it with a self-contained metrics implementation that provides the same functionality: - IntStat: Thread-safe integer counter - PmfStat: Percentile/distribution statistics with reservoir sampling - Stat: Gauge statistics with callable evaluation - StatsCollection: Named collections of statistics - Global registry for metrics access via getStats() The new implementation maintains API compatibility with the existing metrics interface used by the driver. Fixes #665
- Add comparison operators (__eq__, __ne__, __lt__, __le__, __gt__, __ge__) to IntStat class for direct comparison with integers - Add __hash__ method to IntStat for use in sets/dicts - Add Metrics.shutdown() method to remove stats from global registry - Call metrics.shutdown() from Cluster.shutdown() to prevent stale weakref errors when accessing getStats() after cluster shutdown - Fix test using 'is' instead of '==' for IntStat comparison - Add unit tests for new comparison operators and shutdown functionality
9e60f4e to
70d218b
Compare
sylwiaszunejko
approved these changes
Feb 2, 2026
|
Note: Even if API of new classes is the same, this is technically a breaking change, right? |
Lorak-mmk
reviewed
Feb 2, 2026
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
|
|
There was a problem hiding this comment.
How could this file be possibly authored by Datastax? Is it taken from some upstream commit we don't yet have?
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
The
scaleslibrary had its last release in 2015 and was only tested on Python 2.7/3.3. This change replaces it with a self-contained metrics implementation that provides the same functionality:IntStat: Thread-safe integer counterPmfStat: Percentile/distribution statistics with reservoir samplingStat: Gauge statistics with callable evaluationStatsCollection: Named collections of statisticsgetStats()The new implementation maintains API compatibility with the existing metrics interface used by the driver.
Test plan
Fixes #665