Stackdriver: Monitor other resources type for k8s horizontal auto-scaling
See original GitHub issueHi,
I have a spring boot application running in kubernetes with custom metrics published to stack driver for its horizontal auto scaling.
I’m interested in using the actuator+micrometrics to gather & handles them.
Do you plan to make the resource more configurable?
For my case here what is needed:
final Map<String, String> resourceLabels = new HashMap<>();
// https://cloud.google.com/kubernetes-engine/docs/tutorials/custom-metrics-autoscaling#exporting_metrics_from_the_application
resourceLabels.put("pod_id", config.podId);
// must be set to empty string
resourceLabels.put("container_name", "");
// can be set to any value (unused)
resourceLabels.put("namespace_id", "");
resourceLabels.put("instance_id", "");
resourceLabels.put("project_id", config.projectId);
resourceLabels.put("cluster_name", config.clusterName);
resourceLabels.put("zone", config.zone);
return MonitoredResource.newBuilder()
.setType("gke_container")
.putAllLabels(resourceLabels)
.build();
Maybe the StackdriverConfig could allows to configure the type
and additional labels for the resource.
public interface StackdriverConfig extends StepRegistryConfig {
@Override
default String prefix() {
return "stackdriver";
}
default String resourceType() {
//
}
default Map<String, String> resourceLabels() {
//
}
default String projectId() {
String v = get(prefix() + ".projectId");
if (v == null)
throw new MissingRequiredConfigurationException("projectId must be set to report metrics to Stackdriver");
return v;
}
}
I’d be happy to provide a PR if you think it would be accepted.
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Cloud Monitoring | Operations Suite - Google Cloud
This page explains how to use Cloud Monitoring to monitor your Google Kubernetes Engine (GKE) clusters. Note: GKE clusters have integrated monitoring and ......
Read more >Kubernetes HPA Autoscaling with Custom and External Metrics
My goal is to add a horizontal pod autoscaler that will scale my deployment based on a Nginx external metrics that the HPA...
Read more >HorizontalPodAutoscaler with external metrics from PubSub ...
This tutorial demonstrates how to automatically scale your GKE workloads based on metrics available in Stackdriver. If you want to autoscale based on...
Read more >HorizontalPodAutoscaler with external metrics from PubSub
Tips and tricks of autoscaling in Google Kubernetes Engine with PubSub Stackdriver metrics adapter running on GKE where you can easily ...
Read more >Monitoring Kubernetes Clusters on GKE (Google Container ...
To implement logging and monitoring in Stackdriver for Kubernetes Engine, ... A horizontal pod autoscaler will work only if the CPU resource ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
lol, now I need to find a plugin that overrides very specific css as I just edited google’s css in dev tools to get this so I can read crap…
Closing this as it is possible to configure the resource labels since #1818 added that configuration. It would be good if we added such generic labels for users when available. Then we could map them to resource labels for Stackdriver as appropriate with less config required from users, and it would be consistently available across meter registries. However, getting the metadata seems challenging in a lot of cases since it isn’t available in environment variables for containers out-of-the-box in generic kubernetes clusters. If there are ideas how we can do this in a generic way, please do open an issue and let’s explore that.