fix parsing error on labels

Change-Id: I990967b93b10dbfa9a564ca4286ffbd051c69697
This commit is contained in:
Han Kang 2022-10-12 09:25:43 -07:00
parent 49c08947f7
commit 0e7814a647
2 changed files with 9 additions and 2 deletions

View File

@ -29,6 +29,7 @@ var metricsOptionStructuresNames = []string{
"GaugeOpts", "GaugeOpts",
"HistogramOpts", "HistogramOpts",
"SummaryOpts", "SummaryOpts",
"TimingHistogramOpts",
} }
func findStableMetricDeclaration(tree ast.Node, metricsImportName string) ([]*ast.CallExpr, []error) { func findStableMetricDeclaration(tree ast.Node, metricsImportName string) ([]*ast.CallExpr, []error) {
@ -98,7 +99,7 @@ func (f *stableMetricFinder) Visit(node ast.Node) (w ast.Visitor) {
func isMetricOps(name string) bool { func isMetricOps(name string) bool {
var found = false var found = false
for _, optsName := range metricsOptionStructuresNames { for _, optsName := range metricsOptionStructuresNames {
if name != optsName { if name == optsName {
found = true found = true
break break
} }

View File

@ -494,7 +494,13 @@ func Register(collectors ...metrics.StableCollector) {
return 0 return 0
}, },
)) ))
_ = metrics.Labels{
"probe_type": "1",
"container": "2",
"pod": "podName",
"namespace": "space",
"pod_uid": "123",
}
}) })
} }