diff --git a/receiver/k8sclusterreceiver/internal/collection/collector.go b/receiver/k8sclusterreceiver/internal/collection/collector.go index b64da9148150..8debcd5fc3f7 100644 --- a/receiver/k8sclusterreceiver/internal/collection/collector.go +++ b/receiver/k8sclusterreceiver/internal/collection/collector.go @@ -23,7 +23,7 @@ import ( "go.opentelemetry.io/collector/model/pdata" "go.uber.org/zap" appsv1 "k8s.io/api/apps/v1" - "k8s.io/api/autoscaling/v2beta2" + v2beta2 "k8s.io/api/autoscaling/v2beta2" batchv1 "k8s.io/api/batch/v1" corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/runtime" @@ -147,7 +147,7 @@ func (dc *DataCollector) SyncMetrics(obj interface{}) { rm = getMetricsForJob(o) case *batchv1.CronJob: rm = getMetricsForCronJob(o) - case *v2beta1.HorizontalPodAutoscaler: + case *v2beta2.HorizontalPodAutoscaler: rm = getMetricsForHPA(o) case *quotav1.ClusterResourceQuota: rm = getMetricsForClusterResourceQuota(o) @@ -184,7 +184,7 @@ func (dc *DataCollector) SyncMetadata(obj interface{}) map[metadata.ResourceID]* km = getMetadataForJob(o) case *batchv1.CronJob: km = getMetadataForCronJob(o) - case *v2beta1.HorizontalPodAutoscaler: + case *v2beta2.HorizontalPodAutoscaler: km = getMetadataForHPA(o) } diff --git a/receiver/k8sclusterreceiver/internal/collection/hpa.go b/receiver/k8sclusterreceiver/internal/collection/hpa.go index 8df359f2fddc..16a5cd903d2c 100644 --- a/receiver/k8sclusterreceiver/internal/collection/hpa.go +++ b/receiver/k8sclusterreceiver/internal/collection/hpa.go @@ -18,7 +18,7 @@ import ( metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" resourcepb "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" conventions "go.opentelemetry.io/collector/model/semconv/v1.5.0" - "k8s.io/api/autoscaling/v2beta2" + v2beta2 "k8s.io/api/autoscaling/v2beta2" metadata "github.com/open-telemetry/opentelemetry-collector-contrib/pkg/experimentalmetricmetadata" "github.com/open-telemetry/opentelemetry-collector-contrib/receiver/k8sclusterreceiver/internal/utils" @@ -52,7 +52,7 @@ var hpaDesiredReplicasMetric = &metricspb.MetricDescriptor{ Type: metricspb.MetricDescriptor_GAUGE_INT64, } -func getMetricsForHPA(hpa *v2beta1.HorizontalPodAutoscaler) []*resourceMetrics { +func getMetricsForHPA(hpa *v2beta2.HorizontalPodAutoscaler) []*resourceMetrics { metrics := []*metricspb.Metric{ { MetricDescriptor: hpaMaxReplicasMetric, @@ -88,7 +88,7 @@ func getMetricsForHPA(hpa *v2beta1.HorizontalPodAutoscaler) []*resourceMetrics { } } -func getResourceForHPA(hpa *v2beta1.HorizontalPodAutoscaler) *resourcepb.Resource { +func getResourceForHPA(hpa *v2beta2.HorizontalPodAutoscaler) *resourcepb.Resource { return &resourcepb.Resource{ Type: k8sType, Labels: map[string]string{ @@ -100,7 +100,7 @@ func getResourceForHPA(hpa *v2beta1.HorizontalPodAutoscaler) *resourcepb.Resourc } } -func getMetadataForHPA(hpa *v2beta1.HorizontalPodAutoscaler) map[metadata.ResourceID]*KubernetesMetadata { +func getMetadataForHPA(hpa *v2beta2.HorizontalPodAutoscaler) map[metadata.ResourceID]*KubernetesMetadata { return map[metadata.ResourceID]*KubernetesMetadata{ metadata.ResourceID(hpa.UID): getGenericMetadata(&hpa.ObjectMeta, "HPA"), }