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

update documentation for metrics with deprecated version and k8s version #113610

Merged
merged 2 commits into from Nov 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions test/instrumentation/README.md
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
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