Skip to content

Commit

Permalink
pr review
Browse files Browse the repository at this point in the history
Signed-off-by: odubajDT <[email protected]>
  • Loading branch information
odubajDT committed Oct 5, 2022
1 parent 115e2da commit be5bcf4
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion operator/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ kind: Kustomization
images:
- name: controller
newName: docker.io/odubajdt/keptn-lifecycle-operator
newTag: metrics10
newTag: latest
4 changes: 2 additions & 2 deletions operator/controllers/keptntask/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ func (r *KeptnTaskReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if !task.IsStartTimeSet() {
// metrics: increment active task counter
r.Meters.TaskActive.Add(ctx, 1, task.GetActiveMetricsAttributes()...)
task.SetStartTime()
}
task.SetStartTime()

err := r.Client.Status().Update(ctx, task)
if err != nil {
Expand Down Expand Up @@ -103,8 +103,8 @@ func (r *KeptnTaskReconciler) Reconcile(ctx context.Context, req ctrl.Request) (
if !task.IsEndTimeSet() {
// metrics: decrement active task counter
r.Meters.TaskActive.Add(ctx, -1, task.GetActiveMetricsAttributes()...)
task.SetEndTime()
}
task.SetEndTime()

err = r.Client.Status().Update(ctx, task)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions operator/controllers/keptnworkloadinstance/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ func (r *KeptnWorkloadInstanceReconciler) Reconcile(ctx context.Context, req ctr
if !workloadInstance.IsStartTimeSet() {
// metrics: increment active deployment counter
r.Meters.DeploymentActive.Add(ctx, 1, workloadInstance.GetActiveMetricsAttributes()...)
workloadInstance.SetStartTime()
}
workloadInstance.SetStartTime()

if !workloadInstance.IsPreDeploymentCompleted() {
r.Log.Info("Pre deployment checks not finished")
Expand Down Expand Up @@ -133,8 +133,8 @@ func (r *KeptnWorkloadInstanceReconciler) Reconcile(ctx context.Context, req ctr
if !workloadInstance.IsEndTimeSet() {
// metrics: decrement active deployment counter
r.Meters.DeploymentActive.Add(ctx, -1, workloadInstance.GetActiveMetricsAttributes()...)
workloadInstance.SetEndTime()
}
workloadInstance.SetEndTime()

err = r.Client.Status().Update(ctx, workloadInstance)
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions operator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import (

otelprom "go.opentelemetry.io/otel/exporters/prometheus"
"go.opentelemetry.io/otel/metric/instrument"
"go.opentelemetry.io/otel/metric/unit"
"go.opentelemetry.io/otel/sdk/metric"

"sigs.k8s.io/controller-runtime/pkg/webhook"
Expand Down Expand Up @@ -88,7 +89,7 @@ func main() {
if err != nil {
setupLog.Error(err, "unable to start OTel")
}
deploymentDuration, err := meter.SyncFloat64().Histogram("keptn.deployment.duration", instrument.WithDescription("a histogram of duration for Keptn deployment"))
deploymentDuration, err := meter.SyncFloat64().Histogram("keptn.deployment.duration", instrument.WithDescription("a histogram of duration for Keptn deployment"), instrument.WithUnit(unit.Unit("s")))
if err != nil {
setupLog.Error(err, "unable to start OTel")
}
Expand All @@ -100,7 +101,7 @@ func main() {
if err != nil {
setupLog.Error(err, "unable to start OTel")
}
taskDuration, err := meter.SyncFloat64().Histogram("keptn.task.duration", instrument.WithDescription("a histogram of duration for Keptn tasks"))
taskDuration, err := meter.SyncFloat64().Histogram("keptn.task.duration", instrument.WithDescription("a histogram of duration for Keptn tasks"), instrument.WithUnit(unit.Unit("s")))
if err != nil {
setupLog.Error(err, "unable to start OTel")
}
Expand Down

0 comments on commit be5bcf4

Please sign in to comment.