@@ -69,27 +69,6 @@ func (p *metricCollector) handleMetric(labels []promwrite.Label, value float64,
69
69
70
70
if shouldSend {
71
71
prevMetric .timestamp = max (prevMetric .timestamp , timestamp - 1_000_000_000 )
72
-
73
- zapLabels := make ([]zap.Field , 0 , len (labels )+ 2 )
74
- timeMetric := time .Unix (0 , prevMetric .timestamp )
75
-
76
- zapLabels = append (zapLabels , zap .Time ("prom_timestamp" , timeMetric ))
77
- zapLabels = append (zapLabels , zap .Time ("current_timestamp" , time .Unix (0 , timestamp )))
78
- for i := range labels {
79
- zapLabels = append (zapLabels , zap .String ("prom_label_" + labels [i ].Name , labels [i ].Value ))
80
- }
81
- p .logger .Info (
82
- "send metric" ,
83
- zapLabels ... ,
84
- )
85
-
86
- if time .Since (timeMetric ) > 5 * time .Minute {
87
- p .logger .Error (
88
- "too old sample" ,
89
- zapLabels ... ,
90
- )
91
- }
92
-
93
72
values = append (values , createTimeSeries (labels , prevMetric ))
94
73
}
95
74
} else {
@@ -119,28 +98,7 @@ func (p *metricCollector) flushOldMetrics() {
119
98
metric := value .(metricValue )
120
99
if now .Sub (metric .lastUpdateTime ) > p .timeout && ! metric .lastValueIsSended {
121
100
labels := keyToLabels (key .(string ))
122
-
123
- zapLabels := make ([]zap.Field , 0 , len (labels )+ 2 )
124
- timeMetric := time .Unix (0 , metric .timestamp )
125
- zapLabels = append (zapLabels , zap .Time ("prom_timestamp" , timeMetric ))
126
- zapLabels = append (zapLabels , zap .Bool ("flush_old_metric" , true ))
127
- for i := range labels {
128
- zapLabels = append (zapLabels , zap .String ("prom_label_" + labels [i ].Name , labels [i ].Value ))
129
- }
130
- p .logger .Info (
131
- "send metric" ,
132
- zapLabels ... ,
133
- )
134
-
135
- if time .Since (timeMetric ) > 10 * time .Minute {
136
- p .logger .Error (
137
- "too old sample" ,
138
- zapLabels ... ,
139
- )
140
- }
141
-
142
101
toSend = append (toSend , createTimeSeries (labels , metric ))
143
-
144
102
metric .lastValueIsSended = true
145
103
p .collector .Store (key , metric )
146
104
}
0 commit comments