Skip to content

Commit

Permalink
Merge pull request #113610 from logicalhan/refactor-stability
Browse files Browse the repository at this point in the history
update documentation for metrics with deprecated version and k8s version
  • Loading branch information
k8s-ci-robot committed Nov 8, 2022
2 parents 0e530f4 + 92c76e5 commit 1a3db7d
Show file tree
Hide file tree
Showing 6 changed files with 825 additions and 470 deletions.
13 changes: 13 additions & 0 deletions test/instrumentation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,16 @@ To update the documented list of metrics for k8s/website, please run:
```console
./test/instrumentation/update-documentation.sh
```

Then you need to copy the output to the appropriate website directory. Please
define the directory in which the website repo lives in an env variable like so:

```shell
export WEBSITE_ROOT=<path to website root>
```

And then from the root of the k8s/k8s repository, please run this command:

```shell
cp ./test/instrumentation/documentation/documentation.md $WEBSITE_ROOT/content/en/docs/reference/instrumentation/metrics.md
```
30 changes: 4 additions & 26 deletions test/instrumentation/decode_metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,31 +287,11 @@ func (c *metricDecoder) decodeMetricVecForTimingRatioHistogram(call *ast.CallExp
func (c *metricDecoder) decodeLabelsFromArray(exprs []ast.Expr) ([]string, error) {
retval := []string{}
for _, e := range exprs {
id, ok := e.(*ast.Ident)
if !ok {
if bl, ok := e.(*ast.BasicLit); ok {
v, err := stringValue(bl)
if err != nil {
return nil, err
}
retval = append(retval, v)
continue
}
return nil, newDecodeErrorf(e, errInvalidNewMetricCall)
}
variableExpr, found := c.variables[id.Name]
if !found {
return nil, newDecodeErrorf(e, "couldn't find variable for labels")
v, err := c.decodeString(e)
if err != nil || v == nil {
return nil, newDecodeErrorf(e, errNonStringAttribute)
}
bl, ok := variableExpr.(*ast.BasicLit)
if !ok {
return nil, newDecodeErrorf(e, "couldn't interpret variable for labels")
}
v, err := stringValue(bl)
if err != nil {
return nil, err
}
retval = append(retval, v)
retval = append(retval, *v)
}

return retval, nil
Expand Down Expand Up @@ -652,9 +632,7 @@ func (c *metricDecoder) decodeInt64(expr ast.Expr) (int64, error) {
return i, err2
}
}

}

case *ast.CallExpr:
_, ok := v.Fun.(*ast.SelectorExpr)
if !ok {
Expand Down

0 comments on commit 1a3db7d

Please sign in to comment.