Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitrii Anoshin <anoshindx@gmail.com>
  • Loading branch information
povilasv and dmitryax committed Jul 14, 2023
1 parent 717166f commit 28d3354
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions receiver/k8sclusterreceiver/internal/cronjob/cronjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,12 @@ func GetMetrics(set receiver.CreateSettings, cj *batchv1.CronJob) pmetric.Metric

mbphase.RecordK8sCronjobActiveJobsDataPoint(ts, int64(len(cj.Status.Active)))

metrics := mbphase.Emit(imetadataphase.WithK8sNamespaceName(cj.Namespace), imetadataphase.WithK8sCronjobUID(string(cj.UID)), imetadataphase.WithK8sCronjobName(cj.Name), imetadataphase.WithOpencensusResourcetype("k8s"))
return metrics
return mbphase.Emit(
imetadataphase.WithK8sNamespaceName(cj.Namespace),
imetadataphase.WithK8sCronjobUID(string(cj.UID)),
imetadataphase.WithK8sCronjobName(cj.Name),
imetadataphase.WithOpencensusResourcetype("k8s"),
)
}

func GetMetricsBeta(set receiver.CreateSettings, cj *batchv1beta1.CronJob) pmetric.Metrics {
Expand All @@ -40,8 +44,13 @@ func GetMetricsBeta(set receiver.CreateSettings, cj *batchv1beta1.CronJob) pmetr

mbphase.RecordK8sCronjobActiveJobsDataPoint(ts, int64(len(cj.Status.Active)))

metrics := mbphase.Emit(imetadataphase.WithK8sNamespaceName(cj.Namespace), imetadataphase.WithK8sCronjobUID(string(cj.UID)), imetadataphase.WithK8sCronjobName(cj.Name), imetadataphase.WithOpencensusResourcetype("k8s"))
return metrics
return mbphase.Emit(
imetadataphase.WithK8sNamespaceName(cj.Namespace),
imetadataphase.WithK8sCronjobUID(string(cj.UID)),
imetadataphase.WithK8sCronjobName(cj.Name),
imetadataphase.WithOpencensusResourcetype("k8s"),
)

}

func GetMetadata(cj *batchv1.CronJob) map[experimentalmetricmetadata.ResourceID]*metadata.KubernetesMetadata {
Expand Down

0 comments on commit 28d3354

Please sign in to comment.