@@ -66,7 +66,7 @@ type MetricsCollector struct {
6666
6767 // Caching for expensive calculations
6868 cacheMutex sync.RWMutex
69- cachedMetrics map [string ]interface {}
69+ cachedMetrics map [string ]any
7070 cacheLastUpdate time.Time
7171 cacheTTL time.Duration
7272
@@ -170,7 +170,7 @@ func NewMonitoringUI(proxy *Proxy) *MonitoringUI {
170170 privacyLevel : proxy .monitoringUI .PrivacyLevel ,
171171 // Initialize caching with 1 second TTL
172172 cacheTTL : time .Second ,
173- cachedMetrics : make (map [string ]interface {} ),
173+ cachedMetrics : make (map [string ]any ),
174174 // Initialize Prometheus
175175 prometheusEnabled : proxy .monitoringUI .PrometheusEnabled ,
176176 proxy : proxy ,
@@ -688,8 +688,8 @@ func (mc *MetricsCollector) collectResolverSnapshots() ([]resolverSnapshot, map[
688688 return snapshots , index
689689}
690690
691- func (mc * MetricsCollector ) collectCacheStats (cacheHitRatio float64 , cacheHits , cacheMisses uint64 ) map [string ]interface {} {
692- stats := map [string ]interface {} {
691+ func (mc * MetricsCollector ) collectCacheStats (cacheHitRatio float64 , cacheHits , cacheMisses uint64 ) map [string ]any {
692+ stats := map [string ]any {
693693 "enabled" : false ,
694694 "configured_size" : 0 ,
695695 "entries" : 0 ,
@@ -718,12 +718,12 @@ func (mc *MetricsCollector) collectCacheStats(cacheHitRatio float64, cacheHits,
718718 return stats
719719}
720720
721- func (mc * MetricsCollector ) collectSourceRefresh () []map [string ]interface {} {
721+ func (mc * MetricsCollector ) collectSourceRefresh () []map [string ]any {
722722 if mc .proxy == nil || len (mc .proxy .sources ) == 0 {
723723 return nil
724724 }
725725
726- results := make ([]map [string ]interface {} , 0 , len (mc .proxy .sources ))
726+ results := make ([]map [string ]any , 0 , len (mc .proxy .sources ))
727727 now := time .Now ()
728728
729729 for _ , source := range mc .proxy .sources {
@@ -765,7 +765,7 @@ func (mc *MetricsCollector) collectSourceRefresh() []map[string]interface{} {
765765 status = "stale"
766766 }
767767
768- entry := map [string ]interface {} {
768+ entry := map [string ]any {
769769 "name" : name ,
770770 "cache_file" : cacheFile ,
771771 "age_seconds" : ageSeconds ,
@@ -799,7 +799,7 @@ func (mc *MetricsCollector) invalidateCache() {
799799}
800800
801801// GetMetrics - Returns the current metrics
802- func (mc * MetricsCollector ) GetMetrics () map [string ]interface {} {
802+ func (mc * MetricsCollector ) GetMetrics () map [string ]any {
803803 // Check cache first
804804 mc .cacheMutex .RLock ()
805805 if time .Since (mc .cacheLastUpdate ) < mc .cacheTTL && mc .cachedMetrics != nil {
@@ -858,7 +858,7 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
858858 }
859859
860860 // Get top domains (limited to 20) sorted by decreasing count
861- topDomainsList := make ([]map [string ]interface {} , 0 )
861+ topDomainsList := make ([]map [string ]any , 0 )
862862 if mc .privacyLevel < 2 {
863863 // Create a slice of domain-count pairs
864864 type domainCount struct {
@@ -884,7 +884,7 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
884884 // Take top 20
885885 count := 0
886886 for _ , dc := range domainCounts {
887- topDomainsList = append (topDomainsList , map [string ]interface {} {
887+ topDomainsList = append (topDomainsList , map [string ]any {
888888 "domain" : html .EscapeString (dc .domain ),
889889 "count" : dc .count ,
890890 })
@@ -896,7 +896,7 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
896896 }
897897
898898 // Get query type distribution sorted by decreasing count and limited to 10
899- queryTypesList := make ([]map [string ]interface {} , 0 )
899+ queryTypesList := make ([]map [string ]any , 0 )
900900
901901 // Create a slice of query type-count pairs
902902 type queryTypeCount struct {
@@ -922,7 +922,7 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
922922 // Take top 10
923923 count := 0
924924 for _ , qtc := range queryTypeCounts {
925- queryTypesList = append (queryTypesList , map [string ]interface {} {
925+ queryTypesList = append (queryTypesList , map [string ]any {
926926 "type" : qtc .qtype ,
927927 "count" : qtc .count ,
928928 })
@@ -938,9 +938,9 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
938938 copy (recentQueries , mc .recentQueries )
939939 mc .queryLogMutex .RUnlock ()
940940
941- resolverHealth := make ([]map [string ]interface {} , 0 , len (resolverSnapshots ))
941+ resolverHealth := make ([]map [string ]any , 0 , len (resolverSnapshots ))
942942 for _ , snapshot := range resolverSnapshots {
943- entry := map [string ]interface {} {
943+ entry := map [string ]any {
944944 "name" : snapshot .name ,
945945 "proto" : snapshot .proto ,
946946 "status" : snapshot .status ,
@@ -968,7 +968,7 @@ func (mc *MetricsCollector) GetMetrics() map[string]interface{} {
968968 generatedAt := time .Now ().UTC ()
969969
970970 // Return all metrics and cache the result
971- metrics := map [string ]interface {} {
971+ metrics := map [string ]any {
972972 "total_queries" : totalQueries ,
973973 "queries_per_second" : queriesPerSecond ,
974974 "uptime_seconds" : time .Since (startTime ).Seconds (),
@@ -1168,7 +1168,7 @@ func (ui *MonitoringUI) handleWebSocket(w http.ResponseWriter, r *http.Request)
11681168
11691169 for {
11701170 // Read message from client
1171- var msg map [string ]interface {}
1171+ var msg map [string ]any
11721172 err := conn .ReadJSON (& msg )
11731173 if err != nil {
11741174 if websocket .IsUnexpectedCloseError (err , websocket .CloseGoingAway , websocket .CloseAbnormalClosure ) {
0 commit comments