doc update for exporters becoming components

This commit is contained in:
Haishi Bai 2019-10-22 19:13:06 -07:00
parent f682ff0fd6
commit a0960caa75
2 changed files with 67 additions and 26 deletions

View File

@ -11,6 +11,7 @@ Dapr adds a HTTP/gRPC middleware to the Dapr sidecar. The middleware intercepts
* No need for code instrumentation. All traffic is automatically traced (with configurable tracing levels).
* Consistent tracing behavior across microservices. Tracing a configured and managed on Dapr sidecar so that it remains consistent across services made by different teams and potentially written in different programming languages.
* Configurable and extensible. By leveraging OpenTelemetry, Dapr tracing can be configured to work with popular tracing backends, including custom backends a customer may have.
* OpenTelemetry exporters are defined as first-class Dapr components. You can define and enable multiple exporters at the same time.
# Correlation ID
@ -18,24 +19,38 @@ For HTTP requests, Dapr injects a **X-Correlation-ID** header to requests. For g
# Configuration
Dapr tracing is configured by a configuration file (in local mode) or a Kubernetes configuration object (in Kubernetes mode). For example, to define a Zipkin exporter, define the following configuration object:
Dapr tracing is configured by a configuration file (in local mode) or a Kubernetes configuration object (in Kubernetes mode). For example, the following configuration object enables distributed tracing:
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: zipkin
name: tracing
spec:
tracing:
enabled: true
exporterType: zipkin
exporterAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
expandParams: true
includeBody: true
```
Please see the [References](#references) section for more details on how to configure tracing on local environment and Kubernetes environment.
# References
* [How-To: Set Up Distributed Tracing](../../howto/diagnose-with-tracing/readme.md)
Dapr supports pluggable exporters, defined by configuration files (in local mode) or a Kubernetes custom resource object (in Kubernetes mode). For example, the following manifest defines a Zipkin exporter:
```yaml
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: zipkin
spec:
type: exporters.zipkin
metadata:
- name: enabled
value: "true"
- name: exporterAddress
value: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
```
# References
* [How-To: Set Up Distributed Tracing](../../howto/diagnose-with-tracing/README.md)

View File

@ -11,43 +11,58 @@ The following steps will show you how to configure Dapr to send distributed trac
First, deploy Zipkin:
```
```bash
kubectl run zipkin --image openzipkin/zipkin --port 9411
```
Create a Kubernetes Service for the Zipkin pod:
```
```bash
kubectl expose deploy zipkin --type ClusterIP --port 9411
```
Next, create the following YAML file locally:
Next, create the following YAML files locally:
```
* zipkin.yaml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
kind: Component
metadata:
name: zipkin
spec:
type: exporters.zipkin
metadata:
- name: enabled
value: "true"
- name: exporterAddress
value: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
```
* tracing.yaml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
spec:
tracing:
enabled: true
exporterType: zipkin
exporterAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
expandParams: true
includeBody: true
```
Finally, deploy the Dapr configuration:
Finally, deploy the Dapr configurations:
```
```bash
kubectl apply -f config.yaml
kubectl apply -f zipkin.yaml
```
In order to enable this configuration for your Dapr sidecar, add the following annotation to your pod spec template:
```
annotations:
dapr.io/config: "zipkin"
dapr.io/config: "tracing"
```
That's it! your sidecar is now configured for use with Open Census and Zipkin.
@ -68,22 +83,37 @@ On your browser, go to ```http://localhost:9411``` and you should see the Zipkin
For standalone mode, create an Dapr Configuration CRD file locally and reference it with the Dapr CLI.
1. Create the following YAML file:
1. Create the following YAML files:
```
* zipkin.yaml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
kind: Component
metadata:
name: zipkin
spec:
type: exporters.zipkin
metadata:
- name: enabled
value: "true"
- name: exporterAddress
value: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
```
* tracing.yaml
```yaml
apiVersion: dapr.io/v1alpha1
kind: Configuration
metadata:
name: tracing
spec:
tracing:
enabled: true
exporterType: zipkin
exporterAddress: "http://localhost:9411/api/v2/spans"
expandParams: true
includeBody: true
```
2. Launch Zipkin using Docker:
```
@ -93,7 +123,7 @@ docker run -d -p 9411:9411 openzipkin/zipkin
3. Launch Dapr with the `--config` param:
```
dapr run --app-id mynode --app-port 3000 --config ./config.yaml node app.js
dapr run --app-id mynode --app-port 3000 --config ./tracing.yaml node app.js
```
## Tracing Configuration
@ -103,8 +133,6 @@ The `tracing` section under the `Configuration` spec contains the following prop
```
tracing:
enabled: true
exporterType: zipkin
exporterAddress: ""
expandParams: true
includeBody: true
```
@ -114,7 +142,5 @@ The following table lists the different properties.
Property | Type | Description
---- | ------- | -----------
enabled | bool | Set tracing to be enabled or disabled
exporterType | string | Name of the Open Census exporter to use. For example: Zipkin, Azure Monitor, etc
exporterAddress | string | URL of the exporter
expandParams | bool | When true, expands parameters passed to HTTP endpoints
includeBody | bool | When true, includes the request body in the tracing event