Update contains and hasPrefix/hasSuffix with the correct examples (#8929)

**What this PR does / why we need it**:
WHAT:
- Update examples for `contains` and `hasSuffix`
- Correct order should be `functionName arg1 arg2 argN`, eg. `contains s
src`

WHY:
- Current example for `contains` and `hasPrefix` / `hasSuffix` has a
wrong order that will cause `TemplateFormatErr`.
- Examples I'm referring to `{{ if .err hasSuffix "Timeout" }} timeout
{{end}}`

**Checklist**
- [ ] Reviewed the
[`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md)
guide (**required**)
- [ ] Documentation added
- [ ] Tests updated
- [ ] `CHANGELOG.md` updated
- [ ] Changes that require user attention or interaction to upgrade are
documented in `docs/sources/upgrading/_index.md`
pull/8968/head^2
Alfredo 3 years ago committed by GitHub
parent 9efbd5ca45
commit f3a49f4734
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      docs/sources/logql/template_functions.md

@ -269,7 +269,7 @@ Signature: `contains(s string, src string) bool`
Examples:
```template
{{ if .err contains "ErrTimeout" }} timeout {{end}}
{{ if contains .err "ErrTimeout" }} timeout {{end}}
{{ if contains "he" "hello" }} yes {{end}}
```
@ -285,7 +285,7 @@ Signatures:
Examples:
```template
{{ if .err hasSuffix "Timeout" }} timeout {{end}}
{{ if hasSuffix .err "Timeout" }} timeout {{end}}
{{ if hasPrefix "he" "hello" }} yes {{end}}
```
@ -758,4 +758,4 @@ Examples:
```template
"{{ .foo | duration_seconds }}"
`{{ duration_seconds .foo }}`
```
```

Loading…
Cancel
Save