Documentation ¶
Index ¶
- func CheckCountData(t *testing.T, name string, wantTags map[string]string, wantValue int64)
- func CheckDistributionData(t *testing.T, name string, wantTags map[string]string, expectedCount int64, ...)
- func CheckLastValueData(t *testing.T, name string, wantTags map[string]string, wantValue float64)
- func CheckStatsNotReported(t *testing.T, names ...string)
- func CheckStatsReported(t *testing.T, names ...string)
- func CheckSumData(t *testing.T, name string, wantTags map[string]string, wantValue float64)
- func Unregister(names ...string)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckCountData ¶
CheckCountData checks the view with a name matching string name to verify that the CountData stats reported are tagged with the tags in wantTags and that wantValue matches reported count.
func CheckDistributionData ¶
func CheckDistributionData(t *testing.T, name string, wantTags map[string]string, expectedCount int64, expectedMin float64, expectedMax float64)
CheckDistributionData checks the view with a name matching string name to verify that the DistributionData stats reported are tagged with the tags in wantTags and that expectedCount number of records were reported. It also checks that expectedMin and expectedMax match the minimum and maximum reported values, respectively.
func CheckLastValueData ¶
CheckLastValueData checks the view with a name matching string name to verify that the LastValueData stats reported are tagged with the tags in wantTags and that wantValue matches reported last value.
func CheckStatsNotReported ¶
CheckStatsNotReported checks that there are no records for any views that a name matching a string in names. Names that do not match registered views are considered not reported.
func CheckStatsReported ¶
CheckStatsReported checks that there is a view registered with the given name for each string in names, and that each view has at least one record.
func CheckSumData ¶
CheckSumData checks the view with a name matching string name to verify that the SumData stats reported are tagged with the tags in wantTags and that wantValue matches the reported sum.
func Unregister ¶
func Unregister(names ...string)
Unregister unregisters the metrics that were registered. This is useful for testing since golang execute test iterations within the same process and opencensus views maintain global state. At the beginning of each test, tests should unregister for all metrics and then re-register for the same metrics. This effectively clears out any existing data and avoids a panic due to re-registering a metric.
In normal process shutdown, metrics do not need to be unregistered.
Types ¶
This section is empty.