Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add metrics to controller loops #76

Merged
merged 6 commits into from
Aug 7, 2023

Conversation

NickKeller
Copy link
Member

Description

Adds metric reporting to the controller runs

Fixes # (issue)
Feature # (details)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration. Is it a breaking change which will impact consuming tool(s)?

  • Unit tests grab the metric values before and after loops are run to verify that the metrics were incremented as expected

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@coveralls
Copy link
Collaborator

coveralls commented Aug 4, 2023

Pull Request Test Coverage Report for Build 5772910844

  • 100 of 153 (65.36%) changed or added relevant lines in 9 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.6%) to 78.094%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller/ingress/concurrency_watchdog.go 7 8 87.5%
pkg/controller/common/resource_reconciler.go 4 6 66.67%
pkg/controller/keyvault/ingress_secret_provider_class.go 17 20 85.0%
pkg/controller/osm/ingress_backend_reconciler.go 16 19 84.21%
pkg/controller/osm/ingress_cert_config_reconciler.go 14 18 77.78%
pkg/controller/service/ingress_reconciler.go 14 19 73.68%
pkg/controller/keyvault/placeholder_pod.go 16 22 72.73%
pkg/controller/keyvault/event_mirror.go 12 20 60.0%
pkg/controller/common/cleaner.go 0 21 0.0%
Files with Coverage Reduction New Missed Lines %
pkg/controller/keyvault/placeholder_pod.go 2 84.3%
pkg/controller/common/cleaner.go 4 34.35%
Totals Coverage Status
Change from base Build 5731338555: 0.6%
Covered Lines: 1590
Relevant Lines: 2036

💛 - Coveralls

@NickKeller NickKeller marked this pull request as ready for review August 4, 2023 20:25
@OliverMKing
Copy link
Collaborator

/ok-to-test sha=4af5d63

Copy link
Collaborator

@OliverMKing OliverMKing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a few small nits. Really nice PR! Exactly what we need

@OliverMKing
Copy link
Collaborator

/ok-to-test sha=b2a8d1c

Copy link
Collaborator

@jaiveerk jaiveerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good, had some nits

@@ -2,6 +2,8 @@ package common

import (
"context"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
"github.com/Azure/aks-app-routing-operator/pkg/controller/testutils"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: imports

defer func() {
c.logger.Info("finished checking on ingress controller pods", "latencySec", time.Since(start).Seconds())

//placing this call inside a closure allows for result and err to be bound after tick executes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should maybe just include this comment once in a README or something similar in the controller dir - that way we don't have to repeat it so frequently.

open to leaving it though if we think that's the cleanest solution, just not a fan of how many times we repeat it

@@ -7,6 +7,8 @@ import (
"container/ring"
"context"
"fmt"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
"github.com/Azure/aks-app-routing-operator/pkg/controller/testutils"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: imports

@@ -5,6 +5,8 @@ package keyvault

import (
"context"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
"github.com/Azure/aks-app-routing-operator/pkg/controller/testutils"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: imports

@@ -6,6 +6,7 @@ package keyvault
import (
"context"
"fmt"
"github.com/Azure/aks-app-routing-operator/pkg/controller/testutils"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports

@@ -5,6 +5,8 @@ package keyvault

import (
"context"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -5,6 +5,8 @@ package osm

import (
"context"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here too

@@ -5,6 +5,8 @@ package service

import (
"context"
"github.com/Azure/aks-app-routing-operator/pkg/controller/metrics"
"github.com/Azure/aks-app-routing-operator/pkg/controller/testutils"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

imports

@OliverMKing OliverMKing merged commit d3afd57 into Azure:main Aug 7, 2023
@OliverMKing
Copy link
Collaborator

Discussed nits with Jaiveer. We decided they aren't blocking so merged this in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants