mirror of https://github.com/istio/istio.io.git
Change metrics task to use integration test file (#357)
* Change metrics task to use integration test file * Update metrics-logs.md
This commit is contained in:
parent
54a7965d36
commit
5d619a0cc6
|
|
@ -32,58 +32,12 @@ as the example application throughout this task.
|
|||
|
||||
## Collecting new telemetry data
|
||||
|
||||
1. Create a new YAML file (`new_rule.yml`) to hold configuration for
|
||||
1. Create a new YAML file to hold configuration for
|
||||
the new metric and log stream that Istio will generate and collect
|
||||
automatically.
|
||||
|
||||
```bash
|
||||
cat <<EOF >new_rule.yml
|
||||
revision: "1"
|
||||
rules:
|
||||
- aspects:
|
||||
- adapter: prometheus
|
||||
kind: metrics
|
||||
params:
|
||||
metrics:
|
||||
- descriptor_name: response_size
|
||||
value: response.size | 0
|
||||
labels:
|
||||
source: source.labels["app"] | "unknown"
|
||||
target: target.service | "unknown"
|
||||
service: target.labels["app"] | "unknown"
|
||||
version: target.labels["version"] | "unknown"
|
||||
method: request.path | "unknown"
|
||||
response_code: response.code | 200
|
||||
- adapter: default
|
||||
kind: access-logs
|
||||
params:
|
||||
logName: combined_log
|
||||
log:
|
||||
descriptor_name: accesslog.combined
|
||||
template_expressions:
|
||||
originIp: origin.ip
|
||||
sourceUser: origin.user
|
||||
timestamp: request.time
|
||||
method: request.method
|
||||
url: request.path
|
||||
protocol: request.scheme
|
||||
responseCode: response.code
|
||||
responseSize: response.size
|
||||
referer: request.referer
|
||||
userAgent: request.headers["user-agent"]
|
||||
labels:
|
||||
originIp: origin.ip
|
||||
sourceUser: origin.user
|
||||
timestamp: request.time
|
||||
method: request.method
|
||||
url: request.path
|
||||
protocol: request.scheme
|
||||
responseCode: response.code
|
||||
responseSize: response.size
|
||||
referer: request.referer
|
||||
userAgent: request.headers["user-agent"]
|
||||
EOF
|
||||
```
|
||||
Save the following as `new_rule.yaml`:
|
||||
<pre data-src="{{home}}/repos/istio/samples/apps/bookinfo/mixer-rule-additional-telemetry.yaml"></pre>
|
||||
|
||||
1. Pick a target service for the new rule.
|
||||
|
||||
|
|
@ -103,14 +57,14 @@ as the example application throughout this task.
|
|||
Error: the server could not find the requested resource
|
||||
```
|
||||
|
||||
If your selected service has service-specific rules, update `new_rule.yml`
|
||||
to include the existing rules appropriately. Append the rule from `new_rule.yml`
|
||||
to the existing `rules` block and save the updated content back over `new_rule.yml`.
|
||||
If your selected service has service-specific rules, update `new_rule.yaml`
|
||||
to include the existing rules appropriately. Append the rule from `new_rule.yaml`
|
||||
to the existing `rules` block and save the updated content back over `new_rule.yaml`.
|
||||
|
||||
1. Push the new configuration to Mixer for a specific service.
|
||||
|
||||
```bash
|
||||
istioctl mixer rule create reviews.default.svc.cluster.local reviews.default.svc.cluster.local -f new_rule.yml
|
||||
istioctl mixer rule create reviews.default.svc.cluster.local reviews.default.svc.cluster.local -f new_rule.yaml
|
||||
```
|
||||
|
||||
1. Send traffic to that service.
|
||||
|
|
|
|||
Loading…
Reference in New Issue