@@ -18,6 +18,7 @@ import (
18
18
kbv1 "github.com/elastic/cloud-on-k8s/pkg/apis/kibana/v1"
19
19
mapsv1alpha1 "github.com/elastic/cloud-on-k8s/pkg/apis/maps/v1alpha1"
20
20
"github.com/elastic/cloud-on-k8s/pkg/controller/common/reconciler"
21
+ "github.com/elastic/cloud-on-k8s/pkg/controller/common/stackmon/monitoring"
21
22
"github.com/elastic/cloud-on-k8s/pkg/controller/kibana"
22
23
"github.com/elastic/cloud-on-k8s/pkg/license"
23
24
"github.com/elastic/cloud-on-k8s/pkg/utils/k8s"
@@ -29,9 +30,11 @@ import (
29
30
)
30
31
31
32
const (
32
- autoscaledResourceCount = "autoscaled_resource_count"
33
- resourceCount = "resource_count"
34
- podCount = "pod_count"
33
+ autoscaledResourceCount = "autoscaled_resource_count"
34
+ resourceCount = "resource_count"
35
+ podCount = "pod_count"
36
+ stackMonitoringLogsCount = "stack_monitoring_logs_count"
37
+ stackMonitoringMetricsCount = "stack_monitoring_metrics_count"
35
38
36
39
timestampFieldName = "timestamp"
37
40
)
@@ -192,11 +195,18 @@ func esStats(k8sClient k8s.Client, managedNamespaces []string) (string, interfac
192
195
}
193
196
194
197
for _ , es := range esList .Items {
198
+ es := es
195
199
stats [resourceCount ]++
196
200
stats [podCount ] += es .Status .AvailableNodes
197
201
if es .IsAutoscalingDefined () {
198
202
stats [autoscaledResourceCount ]++
199
203
}
204
+ if monitoring .IsLogsDefined (& es ) {
205
+ stats [stackMonitoringLogsCount ]++
206
+ }
207
+ if monitoring .IsMetricsDefined (& es ) {
208
+ stats [stackMonitoringMetricsCount ]++
209
+ }
200
210
}
201
211
}
202
212
return "elasticsearches" , stats , nil
0 commit comments