Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 2 of 2 for ObserveCompilation (0.29 sec)

  1. staging/src/k8s.io/apiserver/pkg/cel/metrics/metrics.go

    		}),
    	}
    
    	legacyregistry.MustRegister(m.compilationTime)
    	legacyregistry.MustRegister(m.evaluationTime)
    
    	return m
    }
    
    // ObserveCompilation records a CEL compilation with the time the compilation took.
    func (m *CelMetrics) ObserveCompilation(elapsed time.Duration) {
    	seconds := elapsed.Seconds()
    	m.compilationTime.Observe(seconds)
    }
    
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Fri Dec 09 23:50:48 UTC 2022
    - 2.1K bytes
    - Viewed (0)
  2. staging/src/k8s.io/apiserver/pkg/cel/metrics/metrics_test.go

    package metrics
    
    import (
    	"math"
    	"testing"
    	"time"
    
    	"k8s.io/component-base/metrics/legacyregistry"
    )
    
    func TestObserveCompilation(t *testing.T) {
    	defer legacyregistry.Reset()
    	Metrics.ObserveCompilation(2 * time.Second)
    	c, s := gatherHistogram(t, "apiserver_cel_compilation_duration_seconds")
    	if c != 1 {
    		t.Errorf("unexpected count: %v", c)
    	}
    	if math.Abs(s-2.0) > 1e-7 {
    		t.Fatalf("incorrect sum: %v", s)
    	}
    Registered: Sat Jun 15 01:39:40 UTC 2024
    - Last Modified: Mon Oct 10 22:05:55 UTC 2022
    - 1.7K bytes
    - Viewed (0)
Back to top