Add pluggable stats registry for metrics collection#163
Open
Add pluggable stats registry for metrics collection#163
Conversation
- Support multiple proxies with round-robin selection - Add ProxyNetwork enum (IPv4/IPv6 filtering) - Add ProxyType enum (Mobile/Residential/Datacenter) - Add per-domain routing with glob patterns - Add per-proxy statistics (RequestCount, ErrorCount, LastUsed) - Add context-based proxy type selection - Breaking change: replace Proxy string with Proxies []ProxyConfig
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.
to be reviewed after #160 as this branch implements #160 changes
Summary
This PR refactors the metrics collection system to use a pluggable
StatsRegistryinterface with Prometheus-style label support, replacing global atomic counters with a flexible registry pattern that allows integration with external monitoring systems.Changes
Core Infrastructure
stats.go): DefinesCounter,Gauge, andHistograminterfaces with aStatsRegistryfor registrationWithLabels()method for dimensional metricsDataTotal,CDXDedupeTotalBytes, etc. fromclient.goStatsRegistryfield to allow users to provide custom metrics implementationsMetrics Tracked
total_data_written- Total bytes written to WARC fileslocal_deduped_bytes_total,local_deduped_totaldoppelganger_deduped_bytes_total,doppelganger_deduped_totalcdx_deduped_bytes_total,cdx_deduped_totalproxylabel):proxy_requests_total- Total requests through each proxyproxy_errors_total- Total errors for each proxyproxy_last_used_nanoseconds- Last usage timestampUpdated Components
Documentation
stats.gofor interface contractTest Coverage
Benefits
Interface Example
Test Plan