@@ -42,9 +42,6 @@ type IndicesMappings struct {
42
42
client * http.Client
43
43
url * url.URL
44
44
45
- up prometheus.Gauge
46
- totalScrapes , jsonParseFailures prometheus.Counter
47
-
48
45
metrics []* indicesMappingsMetric
49
46
}
50
47
@@ -57,18 +54,6 @@ func NewIndicesMappings(logger log.Logger, client *http.Client, url *url.URL) *I
57
54
client : client ,
58
55
url : url ,
59
56
60
- up : prometheus .NewGauge (prometheus.GaugeOpts {
61
- Name : prometheus .BuildFQName (namespace , subsystem , "up" ),
62
- Help : "Was the last scrape of the Elasticsearch Indices Mappings endpoint successful." ,
63
- }),
64
- totalScrapes : prometheus .NewCounter (prometheus.CounterOpts {
65
- Name : prometheus .BuildFQName (namespace , subsystem , "scrapes_total" ),
66
- Help : "Current total Elasticsearch Indices Mappings scrapes." ,
67
- }),
68
- jsonParseFailures : prometheus .NewCounter (prometheus.CounterOpts {
69
- Name : prometheus .BuildFQName (namespace , subsystem , "json_parse_failures_total" ),
70
- Help : "Number of errors while parsing JSON." ,
71
- }),
72
57
metrics : []* indicesMappingsMetric {
73
58
{
74
59
Type : prometheus .GaugeValue ,
@@ -117,10 +102,6 @@ func (im *IndicesMappings) Describe(ch chan<- *prometheus.Desc) {
117
102
for _ , metric := range im .metrics {
118
103
ch <- metric .Desc
119
104
}
120
-
121
- ch <- im .up .Desc ()
122
- ch <- im .totalScrapes .Desc ()
123
- ch <- im .jsonParseFailures .Desc ()
124
105
}
125
106
126
107
func (im * IndicesMappings ) getAndParseURL (u * url.URL ) (* IndicesMappingsResponse , error ) {
@@ -148,7 +129,6 @@ func (im *IndicesMappings) getAndParseURL(u *url.URL) (*IndicesMappingsResponse,
148
129
149
130
var imr IndicesMappingsResponse
150
131
if err := json .Unmarshal (body , & imr ); err != nil {
151
- im .jsonParseFailures .Inc ()
152
132
return nil , err
153
133
}
154
134
@@ -163,24 +143,14 @@ func (im *IndicesMappings) fetchAndDecodeIndicesMappings() (*IndicesMappingsResp
163
143
164
144
// Collect gets all indices mappings metric values
165
145
func (im * IndicesMappings ) Collect (ch chan <- prometheus.Metric ) {
166
-
167
- im .totalScrapes .Inc ()
168
- defer func () {
169
- ch <- im .up
170
- ch <- im .totalScrapes
171
- ch <- im .jsonParseFailures
172
- }()
173
-
174
146
indicesMappingsResponse , err := im .fetchAndDecodeIndicesMappings ()
175
147
if err != nil {
176
- im .up .Set (0 )
177
148
level .Warn (im .logger ).Log (
178
149
"msg" , "failed to fetch and decode cluster mappings stats" ,
179
150
"err" , err ,
180
151
)
181
152
return
182
153
}
183
- im .up .Set (1 )
184
154
185
155
for _ , metric := range im .metrics {
186
156
for indexName , mappings := range * indicesMappingsResponse {
0 commit comments