Skip to content

Commit

Permalink
Otel-collector-contrib-7386 replacing autoscaling/v2beta1 with autosc…
Browse files Browse the repository at this point in the history
…aling/v2beta2 k8s api from receiver/k8scluster
  • Loading branch information
shree007 authored and hero committed Jan 27, 2022
1 parent d84dab0 commit 4010688
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions receiver/k8sclusterreceiver/internal/collection/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}

Expand Down
8 changes: 4 additions & 4 deletions receiver/k8sclusterreceiver/internal/collection/hpa.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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{
Expand All @@ -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"),
}
Expand Down

0 comments on commit 4010688

Please sign in to comment.