@@ -81,14 +81,14 @@ func (t *TaskCollector) Update(ctx context.Context, ch chan<- prometheus.Metric)
81
81
return nil
82
82
}
83
83
84
- func (t * TaskCollector ) fetchTasks (_ context.Context ) (TasksResponse , error ) {
84
+ func (t * TaskCollector ) fetchTasks (_ context.Context ) (tasksResponse , error ) {
85
85
u := t .u .ResolveReference (& url.URL {Path : "_tasks" })
86
86
q := u .Query ()
87
87
q .Set ("group_by" , "none" )
88
88
q .Set ("actions" , actionFilter )
89
89
u .RawQuery = q .Encode ()
90
90
91
- var tr TasksResponse
91
+ var tr tasksResponse
92
92
res , err := t .hc .Get (u .String ())
93
93
if err != nil {
94
94
return tr , fmt .Errorf ("failed to get data stream stats health from %s://%s:%s%s: %s" ,
@@ -118,27 +118,26 @@ func (t *TaskCollector) fetchTasks(_ context.Context) (TasksResponse, error) {
118
118
return tr , err
119
119
}
120
120
121
- // TasksResponse is a representation of the Task management API.
122
- type TasksResponse struct {
123
- Tasks []TaskResponse `json:"tasks"`
121
+ // tasksResponse is a representation of the Task management API.
122
+ type tasksResponse struct {
123
+ Tasks []taskResponse `json:"tasks"`
124
124
}
125
125
126
- // TaskResponse is a representation of the individual task item returned by task API endpoint.
126
+ // taskResponse is a representation of the individual task item returned by task API endpoint.
127
127
//
128
128
// We only parse a very limited amount of this API for use in aggregation.
129
- type TaskResponse struct {
129
+ type taskResponse struct {
130
130
Action string `json:"action"`
131
131
}
132
132
133
- type AggregatedTaskStats struct {
133
+ type aggregatedTaskStats struct {
134
134
CountByAction map [string ]int64
135
135
}
136
136
137
- func AggregateTasks (t TasksResponse ) * AggregatedTaskStats {
137
+ func AggregateTasks (t tasksResponse ) aggregatedTaskStats {
138
138
actions := map [string ]int64 {}
139
139
for _ , task := range t .Tasks {
140
140
actions [task .Action ]++
141
141
}
142
- agg := & AggregatedTaskStats {CountByAction : actions }
143
- return agg
142
+ return aggregatedTaskStats {CountByAction : actions }
144
143
}
0 commit comments