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

Fix for latency metric spurious entries #3298

Merged
merged 1 commit into from
Feb 21, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions test/crd_checks.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ import (
"fmt"
"time"

"github.com/knative/pkg/test/logging"
pkgTest "github.com/knative/pkg/test"
"github.com/knative/serving/pkg/apis/serving/v1alpha1"
"github.com/pkg/errors"
"go.opencensus.io/trace"
apiv1beta1 "k8s.io/api/extensions/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/wait"
Expand All @@ -44,8 +44,7 @@ const (
// error or timeout. desc will be used to name the metric that is emitted to
// track how long it took for name to get into the state checked by inState.
func WaitForRouteState(client *ServingClients, name string, inState func(r *v1alpha1.Route) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForRouteState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForRouteState/%s/%s", name, desc))
defer span.End()

var lastState *v1alpha1.Route
Expand Down Expand Up @@ -85,8 +84,7 @@ func CheckRouteState(client *ServingClients, name string, inState func(r *v1alph
// is done, returns an error or timeout. desc will be used to name the metric
// that is emitted to track how long it took for name to get into the state checked by inState.
func WaitForConfigurationState(client *ServingClients, name string, inState func(c *v1alpha1.Configuration) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForConfigurationState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForConfigurationState/%s/%s", name, desc))
defer span.End()

var lastState *v1alpha1.Configuration
Expand Down Expand Up @@ -126,8 +124,7 @@ func CheckConfigurationState(client *ServingClients, name string, inState func(r
// is done, returns an error or timeout. desc will be used to name the metric
// that is emitted to track how long it took for name to get into the state checked by inState.
func WaitForRevisionState(client *ServingClients, name string, inState func(r *v1alpha1.Revision) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForRevision/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForRevision/%s/%s", name, desc))
defer span.End()

var lastState *v1alpha1.Revision
Expand Down Expand Up @@ -167,8 +164,7 @@ func CheckRevisionState(client *ServingClients, name string, inState func(r *v1a
// is done, returns an error or timeout. desc will be used to name the metric
// that is emitted to track how long it took for name to get into the state checked by inState.
func WaitForServiceState(client *ServingClients, name string, inState func(s *v1alpha1.Service) (bool, error), desc string) error {
metricName := fmt.Sprintf("WaitForServiceState/%s/%s", name, desc)
_, span := trace.StartSpan(context.Background(), metricName)
span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForServiceState/%s/%s", name, desc))
defer span.End()

var lastState *v1alpha1.Service
Expand Down