mirror of https://github.com/dapr/docs.git
Merge branch 'master' into update-cli-ref
This commit is contained in:
commit
9f890c6c01
|
|
@ -29,7 +29,7 @@ Read [W3C distributed tracing]({{< ref w3c-tracing >}}) for more background on W
|
|||
|
||||
Dapr uses [probabilistic sampling](https://opencensus.io/tracing/sampling/probabilistic/) as defined by OpenCensus. The sample rate defines the probability a tracing span will be sampled and can have a value between 0 and 1 (inclusive). The deafault sample rate is 0.0001 (i.e. 1 in 10,000 spans is sampled).
|
||||
|
||||
To change the default tracing behavior, use a configuration file (in self hosted mode) or a Kubernetes configuration object (in Kubernetes mode). For example, the following configuration object changes the sample rate to 1 (i.e. every span is sampled):
|
||||
To change the default tracing behavior, use a configuration file (in self hosted mode) or a Kubernetes configuration object (in Kubernetes mode). For example, the following configuration object changes the sample rate to 1 (i.e. every span is sampled), and sends trace using Zipkin protocol to the Zipkin server at http://zipkin.default.svc.cluster.local
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
|
|
@ -40,30 +40,14 @@ metadata:
|
|||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
Similarly, changing `samplingRate` to 0 will disable tracing altogether.
|
||||
Changing `samplingRate` to 0 will disable tracing altogether.
|
||||
|
||||
See the [References](#references) section for more details on how to configure tracing on local environment and Kubernetes environment.
|
||||
|
||||
Dapr supports pluggable exporters, defined by configuration files (in self hosted 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
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
version: v1
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
## References
|
||||
|
||||
- [How-To: Setup Application Insights for distributed tracing with OpenTelemetry Collector]({{< ref open-telemetry-collector.md >}})
|
||||
|
|
|
|||
|
|
@ -308,7 +308,7 @@ Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"status":
|
|||
|
||||
{{< /tabs >}}
|
||||
|
||||
Dapr automatically wraps the user payload in a Cloud Events v1.0 compliant envelope.
|
||||
Dapr automatically wraps the user payload in a Cloud Events v1.0 compliant envelope, using `Content-Type` header value for `datacontenttype` attribute.
|
||||
|
||||
## Step 4: ACK-ing a message
|
||||
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ When multiple instances of the same application ID subscribe to a topic, Dapr wi
|
|||
|
||||
### Cloud events
|
||||
|
||||
Dapr follows the [CloudEvents 1.0 Spec](https://github.com/cloudevents/spec/tree/v1.0) and wraps any payload sent to a topic inside a Cloud Events envelope.
|
||||
Dapr follows the [CloudEvents 1.0 Spec](https://github.com/cloudevents/spec/tree/v1.0) and wraps any payload sent to a topic inside a Cloud Events envelope, using `Content-Type` header value for `datacontenttype` attribute.
|
||||
|
||||
The following fields from the Cloud Events spec are implemented with Dapr:
|
||||
- `id`
|
||||
|
|
|
|||
|
|
@ -20,14 +20,14 @@ Every binding has its own unique set of properties. Click the name link to see t
|
|||
| [Kubernetes Events]({{< ref "kubernetes-binding.md" >}}) | ✅ | | Experimental |
|
||||
| [MQTT]({{< ref mqtt.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [PostgreSql]({{< ref postgres.md >}}) | | ✅ | Experimental |
|
||||
| [Postmark]({{< ref postmark.md >}}) | | ✅ | Experimental |
|
||||
| [RabbitMQ]({{< ref rabbitmq.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [Redis]({{< ref redis.md >}}) | | ✅ | Experimental |
|
||||
| [Twilio]({{< ref twilio.md >}}) | | ✅ | Experimental |
|
||||
| [Twitter]({{< ref twitter.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [SendGrid]({{< ref sendgrid.md >}}) | | ✅ | Experimental |
|
||||
|
||||
|
||||
### Amazon Web Service (AWS)
|
||||
### Amazon Web Services (AWS)
|
||||
|
||||
| Name | Input<br>Binding | Output<br>Binding | Status |
|
||||
|------|:----------------:|:-----------------:|--------|
|
||||
|
|
@ -37,7 +37,6 @@ Every binding has its own unique set of properties. Click the name link to see t
|
|||
| [AWS SQS]({{< ref sqs.md >}}) | ✅ | ✅ | Experimental |
|
||||
| [AWS Kinesis]({{< ref kinesis.md >}}) | ✅ | ✅ | Experimental |
|
||||
|
||||
|
||||
### Google Cloud Platform (GCP)
|
||||
|
||||
| Name | Input<br>Binding | Output<br>Binding | Status |
|
||||
|
|
|
|||
|
|
@ -0,0 +1,69 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Postmark binding spec"
|
||||
linkTitle: "Postmark"
|
||||
description: "Detailed documentation on the Postmark binding component"
|
||||
---
|
||||
|
||||
## Setup Dapr component
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: postmark
|
||||
namespace: default
|
||||
spec:
|
||||
type: bindings.postmark
|
||||
metadata:
|
||||
- name: accountToken
|
||||
value: "YOUR_ACCOUNT_TOKEN" # required, this is your Postmark account token
|
||||
- name: serverToken
|
||||
value: "YOUR_SERVER_TOKEN" # required, this is your Postmark server token
|
||||
- name: emailFrom
|
||||
value: "testapp@dapr.io" # optional
|
||||
- name: emailTo
|
||||
value: "dave@dapr.io" # optional
|
||||
- name: subject
|
||||
value: "Hello!" # optional
|
||||
```
|
||||
|
||||
- `accountToken` is your Postmark account token, this should be considered a secret value. Required.
|
||||
- `serverToken` is your Postmark server token, this should be considered a secret value. Required.
|
||||
- `emailFrom` If set this specifies the 'from' email address of the email message. Optional field, see below.
|
||||
- `emailTo` If set this specifies the 'to' email address of the email message. Optional field, see below.
|
||||
- `emailCc` If set this specifies the 'cc' email address of the email message. Optional field, see below.
|
||||
- `emailBcc` If set this specifies the 'bcc' email address of the email message. Optional field, see below.
|
||||
- `subject` If set this specifies the subject of the email message. Optional field, see below.
|
||||
|
||||
You can specify any of the optional metadata properties on the output binding request too (e.g. `emailFrom`, `emailTo`, `subject`, etc.)
|
||||
|
||||
Combined, the optional metadata properties in the component configuration and the request payload should at least contain the `emailFrom`, `emailTo` and `subject` fields, as these are required to send an email with success.
|
||||
|
||||
Example request payload
|
||||
|
||||
```json
|
||||
{
|
||||
"operation": "create",
|
||||
"metadata": {
|
||||
"emailTo": "changeme@example.net",
|
||||
"subject": "An email from Dapr Postmark binding"
|
||||
},
|
||||
"data": "<h1>Testing Dapr Bindings</h1>This is a test.<br>Bye!"
|
||||
}
|
||||
```
|
||||
|
||||
{{% alert title="Warning" color="warning" %}}
|
||||
The above example uses secrets as plain strings. It is recommended to use a secret store for the secrets as described [here]({{< ref component-secrets.md >}}).
|
||||
{{% /alert %}}
|
||||
|
||||
## Output Binding Supported Operations
|
||||
|
||||
- `create`
|
||||
|
||||
## Related links
|
||||
|
||||
- [Bindings building block]({{< ref bindings >}})
|
||||
- [How-To: Trigger application with input binding]({{< ref howto-triggers.md >}})
|
||||
- [How-To: Use bindings to interface with external resources]({{< ref howto-bindings.md >}})
|
||||
- [Bindings API reference]({{< ref bindings_api.md >}})
|
||||
|
|
@ -1,11 +1,35 @@
|
|||
---
|
||||
type: docs
|
||||
title: "How-To: Observe metrics with Grafana"
|
||||
linkTitle: "Grafana"
|
||||
linkTitle: "Metrics dashboards with Grafana"
|
||||
weight: 5000
|
||||
description: "How to view Dapr metrics in a Grafana dashboard."
|
||||
---
|
||||
|
||||
## Available dashboards
|
||||
|
||||
{{< tabs "System Service" "Sidecars" "Actors" >}}
|
||||
|
||||
{{% codetab %}}
|
||||
The `grafana-system-services-dashboard.json` template shows Dapr system component status, dapr-operator, dapr-sidecar-injector, dapr-sentry, and dapr-placement:
|
||||
|
||||
<img src="/images/grafana-system-service-dashboard.png" alt="Screenshot of the system service dashboard" width=1200>
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
The `grafana-sidecar-dashboard.json` template shows Dapr sidecar status, including sidecar health/resources, throughput/latency of HTTP and gRPC, Actor, mTLS, etc.:
|
||||
|
||||
<img src="/images/grafana-sidecar-dashboard.png" alt="Screenshot of the sidecar dashboard" width=1200>
|
||||
{{% /codetab %}}
|
||||
|
||||
{{% codetab %}}
|
||||
The `grafana-actor-dashboard.json` template shows Dapr Sidecar status, actor invocation throughput/latency, timer/reminder triggers, and turn-based concurrnecy:
|
||||
|
||||
<img src="/images/grafana-actor-dashboard.png" alt="Screenshot of the actor dashboard" width=1200>
|
||||
{{% /codetab %}}
|
||||
|
||||
{{< /tabs >}}
|
||||
|
||||
## Pre-requisites
|
||||
|
||||
- [Setup Prometheus]({{<ref prometheus.md>}})
|
||||
|
|
@ -14,40 +38,36 @@ description: "How to view Dapr metrics in a Grafana dashboard."
|
|||
|
||||
### Install Grafana
|
||||
|
||||
1. Install Grafana
|
||||
|
||||
Add the Grafana Helm repo:
|
||||
1. Add the Grafana Helm repo:
|
||||
|
||||
```bash
|
||||
helm repo add grafana https://grafana.github.io/helm-charts
|
||||
```
|
||||
|
||||
Install the chart:
|
||||
1. Install the chart:
|
||||
|
||||
```bash
|
||||
helm install grafana grafana/grafana -n dapr-monitoring
|
||||
```
|
||||
|
||||
If you are Minikube user or want to disable persistent volume for development purpose, you can disable it by using the following command:
|
||||
{{% alert title="Note" color="primary" %}}
|
||||
If you are Minikube user or want to disable persistent volume for development purpose, you can disable it by using the following command instead:
|
||||
|
||||
```bash
|
||||
helm install grafana grafana/grafana -n dapr-monitoring --set persistence.enabled=false
|
||||
```
|
||||
{{% /alert %}}
|
||||
|
||||
2. Retrieve the admin password for Grafana login
|
||||
|
||||
1. Retrieve the admin password for Grafana login:
|
||||
|
||||
```bash
|
||||
kubectl get secret --namespace dapr-monitoring grafana -o jsonpath="{.data.admin-password}" | base64 --decode ; echo
|
||||
cj3m0OfBNx8SLzUlTx91dEECgzRlYJb60D2evof1%
|
||||
```
|
||||
|
||||
{{% alert title="Note" color="info" %}}
|
||||
Remove the `%` character from the password that this command returns. For example, the admin password is `cj3m0OfBNx8SLzUlTx91dEECgzRlYJb60D2evof1`.
|
||||
{{% /alert %}}
|
||||
You will get a password similar to `cj3m0OfBNx8SLzUlTx91dEECgzRlYJb60D2evof1%`. Remove the `%` character from the password to get `cj3m0OfBNx8SLzUlTx91dEECgzRlYJb60D2evof1` as the admin password.
|
||||
|
||||
3. Validation
|
||||
|
||||
Ensure Grafana is running in your cluster (see last line below)
|
||||
1. Validation Grafana is running in your cluster:
|
||||
|
||||
```bash
|
||||
kubectl get pods -n dapr-monitoring
|
||||
|
|
@ -66,31 +86,37 @@ description: "How to view Dapr metrics in a Grafana dashboard."
|
|||
### Configure Prometheus as data source
|
||||
First you need to connect Prometheus as a data source to Grafana.
|
||||
|
||||
1. Port-forward to svc/grafana
|
||||
1. Port-forward to svc/grafana:
|
||||
|
||||
```bash
|
||||
$ kubectl port-forward svc/grafana 8080:80 -n dapr-monitoring
|
||||
kubectl port-forward svc/grafana 8080:80 -n dapr-monitoring
|
||||
|
||||
Forwarding from 127.0.0.1:8080 -> 3000
|
||||
Forwarding from [::1]:8080 -> 3000
|
||||
Handling connection for 8080
|
||||
Handling connection for 8080
|
||||
```
|
||||
|
||||
2. Browse `http://localhost:8080`
|
||||
1. Open a browser to `http://localhost:8080`
|
||||
|
||||
3. Login with admin and password
|
||||
1. Login to Grafana
|
||||
- Username = `admin`
|
||||
- Password = Password from above
|
||||
|
||||
4. Click Configuration Settings -> Data Sources
|
||||
1. Select `Configuration` and `Data Sources`
|
||||
|
||||

|
||||
<img src="/images/grafana-datasources.png" alt="Screenshot of the Grafana add Data Source menu" width=200>
|
||||
|
||||
5. Add Prometheus as a data source.
|
||||
|
||||

|
||||
1. Add Prometheus as a data source.
|
||||
|
||||
6. Enter Promethesus server address in your cluster.
|
||||
<img src="/images/grafana-add-datasources.png" alt="Screenshot of the Prometheus add Data Source" width=600>
|
||||
|
||||
You can get the Prometheus server address by running the following command.
|
||||
1. Get your Prometheus HTTP URL
|
||||
|
||||
The Prometheus HTTP URL follows the format `http://<prometheus service endpoint>.<namespace>`
|
||||
|
||||
Start by getting the Prometheus server endpoint by running the following command:
|
||||
|
||||
```bash
|
||||
kubectl get svc -n dapr-monitoring
|
||||
|
|
@ -108,40 +134,43 @@ First you need to connect Prometheus as a data source to Grafana.
|
|||
|
||||
```
|
||||
|
||||
In this Howto, the server is `dapr-prom-prometheus-server`.
|
||||
In this guide the server name is `dapr-prom-prometheus-server` and the namespace is `dapr-monitoring`, so the HTTP URL will be `http://dapr-prom-prometheus-server.dapr-monitoring`.
|
||||
|
||||
You now need to set up Prometheus data source with the following settings:
|
||||
1. Fill in the following settings:
|
||||
|
||||
- Name: `Dapr`
|
||||
- HTTP URL: `http://dapr-prom-prometheus-server.dapr-monitoring`
|
||||
- Default: On
|
||||
|
||||

|
||||
<img src="/images/grafana-prometheus-dapr-server-url.png" alt="Screenshot of the Prometheus Data Source configuration" width=600>
|
||||
|
||||
7. Click `Save & Test` button to verify that the connection succeeded.
|
||||
1. Click `Save & Test` button to verify that the connection succeeded.
|
||||
|
||||
## Import dashboards in Grafana
|
||||
Next you import the Dapr dashboards into Grafana.
|
||||
|
||||
In the upper left, click the "+" then "Import".
|
||||
1. In the upper left corner of the Grafana home screen, click the "+" option, then "Import".
|
||||
|
||||
You can now import built-in [Grafana dashboard templates](https://github.com/dapr/dapr/tree/master/grafana).
|
||||
You can now import [Grafana dashboard templates](https://github.com/dapr/dapr/tree/master/grafana) from [release assets](https://github.com/dapr/dapr/releases) for your Dapr version:
|
||||
|
||||
The Grafana dashboards are part of [release assets](https://github.com/dapr/dapr/releases) with this URL https://github.com/dapr/dapr/releases/
|
||||
You can find `grafana-actor-dashboard.json`, `grafana-sidecar-dashboard.json` and `grafana-system-services-dashboard.json` in release assets location.
|
||||
<img src="/images/grafana-uploadjson.png" alt="Screenshot of the Grafana dashboard upload option" width=700>
|
||||
|
||||

|
||||
1. Find the dashboard that you imported and enjoy
|
||||
|
||||
8. Find the dashboard that you imported and enjoy!
|
||||
<img src="/images/system-service-dashboard.png" alt="Screenshot of Dapr service dashbaord" width=900>
|
||||
|
||||

|
||||
{{% alert title="Tip" color="primary" %}}
|
||||
Hover your mouse over the `i` in the corner to the description of each chart:
|
||||
|
||||
<img src="/images/grafana-tooltip.png" alt="Screenshot of the tooltip for graphs" width=700>
|
||||
{{% /alert %}}
|
||||
|
||||
## References
|
||||
|
||||
* [Set up Prometheus and Grafana]({{< ref grafana.md >}})
|
||||
* [Dapr Observability]({{<ref observability-concept.md >}})
|
||||
* [Prometheus Installation](https://github.com/prometheus-community/helm-charts)
|
||||
* [Prometheus on Kubernetes](https://github.com/coreos/kube-prometheus)
|
||||
* [Prometheus Query Language](https://prometheus.io/docs/prometheus/latest/querying/basics/)
|
||||
* [Supported Dapr metrics](https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics.md)
|
||||
|
||||
## Example
|
||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/8W-iBDNvCUM?start=2577" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||
|
|
@ -28,30 +28,29 @@ docker run -d --name jaeger \
|
|||
|
||||
Next, create the following YAML files locally:
|
||||
|
||||
* **jaeger.yaml**: Note that because we are using the Zipkin protocol to talk to Jaeger,
|
||||
the type of the exporter in the YAML file below is `exporter.zipkin`,
|
||||
while the `exporterAddress` is the address of the Jaeger instance.
|
||||
* **config.yaml**: Note that because we are using the Zipkin protocol
|
||||
to talk to Jaeger, we specify the `zipkin` section of tracing
|
||||
configuration set the `endpointAddress` to address of the Jaeger
|
||||
instance.
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: zipkin
|
||||
name: tracing
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "http://localhost:9412/api/v2/spans"
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://localhost:9412/api/v2/spans"
|
||||
```
|
||||
|
||||
To launch the application referring to the new YAML file, you can use
|
||||
`--components-path`. Assuming that, the **jaeger.yaml** file is in the
|
||||
current directory, you can use
|
||||
`--config` option:
|
||||
|
||||
```bash
|
||||
dapr run --app-id mynode --app-port 3000 node app.js --components-path .
|
||||
dapr run --app-id mynode --app-port 3000 node app.js --config config.yaml
|
||||
```
|
||||
|
||||
### Viewing Traces
|
||||
|
|
@ -92,26 +91,7 @@ kubectl apply -f jaeger-operator.yaml
|
|||
kubectl wait deploy --selector app.kubernetes.io/name=jaeger --for=condition=available
|
||||
```
|
||||
|
||||
Next, create the following YAML files locally:
|
||||
|
||||
* **jaeger.yaml**: Note that because we are using the Zipkin protocol to talk to Jaeger,
|
||||
the type of the exporter in the YAML file below is `exporter.zipkin`,
|
||||
while the `exporterAddress` is the address of the Jaeger instance.
|
||||
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: zipkin
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "http://jaeger-collector.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
Next, create the following YAML file locally:
|
||||
|
||||
* **tracing.yaml**
|
||||
|
||||
|
|
@ -124,13 +104,14 @@ metadata:
|
|||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://jaeger-collector.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
Finally, deploy the the Dapr component and configuration files:
|
||||
|
||||
```bash
|
||||
kubectl apply -f tracing.yaml
|
||||
kubectl apply -f jaeger.yaml
|
||||
```
|
||||
|
||||
In order to enable this configuration for your Dapr sidecar, add the following annotation to your pod spec template:
|
||||
|
|
|
|||
|
|
@ -10,25 +10,23 @@ description: "Set-up New Relic for Dapr observability"
|
|||
|
||||
- Perpetually [free New Relic account](https://newrelic.com/signup), 100 GB/month of free data ingest, 1 free full access user, unlimited free basic users
|
||||
|
||||
## Configure Zipkin Exporter
|
||||
## Configure Dapr tracing
|
||||
|
||||
Dapr natively captures metrics and traces that can be send directly to New Relic. The easiest way to export these is by providing a Zipkin exporter configured to send the traces to [New Relic's Trace API](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api#existing-zipkin).
|
||||
Dapr natively captures metrics and traces that can be send directly to New Relic. The easiest way to export these is by configuring Dapr to send the traces to [New Relic's Trace API](https://docs.newrelic.com/docs/understand-dependencies/distributed-tracing/trace-api/report-zipkin-format-traces-trace-api#existing-zipkin) using the Zipkin trace format.
|
||||
|
||||
In order for the integration to send data to New Relic [Telemetry Data Platform](https://newrelic.com/platform/telemetry-data-platform), you need a [New Relic Insights Insert API key](https://docs.newrelic.com/docs/apis/get-started/intro-apis/types-new-relic-api-keys#insights-insert-key).
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: zipkin
|
||||
name: appconfig
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "https://trace-api.newrelic.com/trace/v1?Api-Key=<NR-INSIGHTS-INSERT-API-KEY>&Data-Format=zipkin&Data-Format-Version=2"
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "https://trace-api.newrelic.com/trace/v1?Api-Key=<NR-INSIGHTS-INSERT-API-KEY>&Data-Format=zipkin&Data-Format-Version=2"
|
||||
```
|
||||
|
||||
### Viewing Traces
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ weight: 1000
|
|||
description: "How to use Dapr to push trace events to Azure Application Insights, through the OpenTelemetry Collector."
|
||||
---
|
||||
|
||||
Dapr can integrate with [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) using the OpenCensus API. This guide walks through an example to use Dapr to push trace events to Azure Application Insights, through the OpenTelemetry Collector.
|
||||
Dapr can integrate with [OpenTelemetry Collector](https://github.com/open-telemetry/opentelemetry-collector) using the Zipkin API. This guide walks through an example to use Dapr to push trace events to Azure Application Insights, through the OpenTelemetry Collector.
|
||||
|
||||
## Requirements
|
||||
|
||||
|
|
@ -35,9 +35,9 @@ Next, install the OpenTelemetry Collector to your Kubernetes cluster to push eve
|
|||
|
||||
Next, set up both a Dapr configuration file to turn on tracing and deploy a tracing exporter component that uses the OpenTelemetry Collector.
|
||||
|
||||
1. Create a collector-component.yaml file with this [content](/docs/open-telemetry-collector/collector-component.yaml)
|
||||
1. Create a collector-config.yaml file with this [content](/docs/open-telemetry-collector/collector-config.yaml)
|
||||
|
||||
2. Apply the configuration with `kubectl apply -f collector-component.yaml`.
|
||||
2. Apply the configuration with `kubectl apply -f collector-config.yaml`.
|
||||
|
||||
### Deploy your app with tracing
|
||||
|
||||
|
|
|
|||
|
|
@ -9,28 +9,9 @@ type: docs
|
|||
|
||||
## Configure self hosted mode
|
||||
|
||||
For self hosted mode, on running `dapr init` the following YAML files are created by default and they are referenced by default on `dapr run` calls unless otherwise overridden.
|
||||
For self hosted mode, on running `dapr init`:
|
||||
|
||||
1. The following file in `$HOME/dapr/components/zipkin.yaml` or `%USERPROFILE%\dapr\components\zipkin.yaml`:
|
||||
|
||||
* zipkin.yaml
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: zipkin
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
version: v1
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "http://localhost:9411/api/v2/spans"
|
||||
```
|
||||
2. The following file in `$HOME/dapr/config.yaml` or `%USERPROFILE%\dapr\config.yaml`:
|
||||
1. The following YAML file is created by default in `$HOME/dapr/config.yaml` (on Linux/Mac) or `%USERPROFILE%\dapr\config.yaml` (on Windows) and it is referenced by default on `dapr run` calls unless otherwise overridden `:
|
||||
|
||||
* config.yaml
|
||||
|
||||
|
|
@ -43,9 +24,11 @@ metadata:
|
|||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://localhost:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
3. The [openzipkin/zipkin](https://hub.docker.com/r/openzipkin/zipkin/) docker container is launched on running `dapr init` or it can be launched with the following code.
|
||||
2. The [openzipkin/zipkin](https://hub.docker.com/r/openzipkin/zipkin/) docker container is launched on running `dapr init` or it can be launched with the following code.
|
||||
|
||||
Launch Zipkin using Docker:
|
||||
|
||||
|
|
@ -53,7 +36,7 @@ Launch Zipkin using Docker:
|
|||
docker run -d -p 9411:9411 openzipkin/zipkin
|
||||
```
|
||||
|
||||
4. The applications launched with `dapr run` will by default reference the config file in `$HOME/dapr/config.yaml` or `%USERPROFILE%\dapr\config.yaml` and can be overridden with the Dapr CLI using the `--config` param:
|
||||
3. The applications launched with `dapr run` will by default reference the config file in `$HOME/dapr/config.yaml` or `%USERPROFILE%\dapr\config.yaml` and can be overridden with the Dapr CLI using the `--config` param:
|
||||
|
||||
```bash
|
||||
dapr run --app-id mynode --app-port 3000 node app.js
|
||||
|
|
@ -79,25 +62,7 @@ Create a Kubernetes service for the Zipkin pod:
|
|||
kubectl expose deployment zipkin --type ClusterIP --port 9411
|
||||
```
|
||||
|
||||
Next, create the following YAML files locally:
|
||||
|
||||
* zipkin.yaml component
|
||||
|
||||
```yaml
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: zipkin
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.zipkin
|
||||
version: v1
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: exporterAddress
|
||||
value: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
Next, create the following YAML file locally:
|
||||
|
||||
* tracing.yaml configuration
|
||||
|
||||
|
|
@ -110,13 +75,14 @@ metadata:
|
|||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
Finally, deploy the the Dapr component and configuration files:
|
||||
Now, deploy the the Dapr configuration file:
|
||||
|
||||
```bash
|
||||
kubectl apply -f tracing.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:
|
||||
|
|
|
|||
|
|
@ -6,8 +6,6 @@ weight: 3000
|
|||
description: "Configure Dapr to send distributed tracing data"
|
||||
---
|
||||
|
||||
Dapr integrates with Open Census for telemetry and tracing.
|
||||
|
||||
It is recommended to run Dapr with tracing enabled for any production scenario.
|
||||
Since Dapr uses Open Census, you can configure various exporters for tracing and telemetry data based on your environment, whether it is running in the cloud or on-premises.
|
||||
|
||||
|
|
@ -17,22 +15,18 @@ The `tracing` section under the `Configuration` spec contains the following prop
|
|||
|
||||
```yml
|
||||
tracing:
|
||||
enabled: true
|
||||
exporterType: zipkin
|
||||
exporterAddress: ""
|
||||
expandParams: true
|
||||
includeBody: true
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "https://..."
|
||||
```
|
||||
|
||||
The following table lists the different properties.
|
||||
The following table lists the properties for tracing:
|
||||
|
||||
| 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
|
||||
|--------------|--------|-------------|
|
||||
| `samplingRate` | string | Set sampling rate for tracing to be enabled or disabled.
|
||||
| `zipkin.endpointAddress` | string | Set the Zipkin server address.
|
||||
|
||||
|
||||
## Zipkin in stand-alone mode
|
||||
|
|
@ -51,11 +45,9 @@ For Standalone mode, create a Dapr configuration file locally and reference it w
|
|||
namespace: default
|
||||
spec:
|
||||
tracing:
|
||||
enabled: true
|
||||
exporterType: zipkin
|
||||
exporterAddress: "http://localhost:9411/api/v2/spans"
|
||||
expandParams: true
|
||||
includeBody: true
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://localhost:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
2. Launch Zipkin using Docker:
|
||||
|
|
@ -99,11 +91,9 @@ metadata:
|
|||
namespace: default
|
||||
spec:
|
||||
tracing:
|
||||
enabled: true
|
||||
exporterType: zipkin
|
||||
exporterAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
expandParams: true
|
||||
includeBody: true
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://zipkin.default.svc.cluster.local:9411/api/v2/spans"
|
||||
```
|
||||
|
||||
Finally, deploy the Dapr configuration:
|
||||
|
|
|
|||
|
|
@ -46,3 +46,4 @@ Following table lists the error codes returned by Dapr runtime:
|
|||
| ERR_SECRET_STORES_NOT_CONFIGURED | Error that no secret store is configured.
|
||||
| ERR_SECRET_STORE_NOT_FOUND | Error that specified secret store is not found.
|
||||
| ERR_HEALTH_NOT_READY | Error that Dapr is not ready.
|
||||
| ERR_METADATA_GET | Error parsing the Metadata information.
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ type: docs
|
|||
title: "Health API reference"
|
||||
linkTitle: "Health API"
|
||||
description: "Detailed documentation on the health API"
|
||||
weight: 900
|
||||
weight: 700
|
||||
---
|
||||
|
||||
Dapr provides health checking probes that can be used as readiness or liveness of Dapr.
|
||||
|
|
|
|||
|
|
@ -0,0 +1,181 @@
|
|||
---
|
||||
type: docs
|
||||
title: "Metadata API reference"
|
||||
linkTitle: "Metadata API"
|
||||
description: "Detailed documentation on the Metadata API"
|
||||
weight: 800
|
||||
---
|
||||
|
||||
Dapr has a metadata API that returns information about the sidecar allowing runtime discoverability. The metadata endpoint returns among other things, a list of the components loaded and the activated actors (if present).
|
||||
|
||||
The Dapr metadata API also allows you to store additional information in the format of key-value pairs.
|
||||
|
||||
Note: The Dapr metatada endpoint is for instance being used by the Dapr CLI when running dapr in standalone mode to store the PID of the process hosting the sidecar and the command used to run the application.
|
||||
|
||||
## Get the Dapr sidecar information
|
||||
|
||||
Gets the Dapr sidecar information provided by the Metadata Endpoint.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
```http
|
||||
GET http://localhost:<daprPort>/v1.0/metadata
|
||||
```
|
||||
|
||||
### URL Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
daprPort | The Dapr port.
|
||||
|
||||
### HTTP Response Codes
|
||||
|
||||
Code | Description
|
||||
---- | -----------
|
||||
200 | Metadata information returned
|
||||
500 | Dapr could not return the metadata information
|
||||
|
||||
### HTTP Response Body
|
||||
|
||||
**Metadata API Response Object**
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
id | string | Application ID
|
||||
actors | [Metadata API Response Registered Actor](#metadataapiresponseactor)[] | A json encoded array of Registered Actors metadata.
|
||||
extended.attributeName | string | List of custom attributes as key-value pairs, where key is the attribute name.
|
||||
components | [Metadata API Response Component](#metadataapiresponsecomponent)[] | A json encoded array of loaded components metadata.
|
||||
|
||||
<a id="metadataapiresponseactor"></a>**Metadata API Response Registered Actor**
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
type | string | The registered actor type.
|
||||
count | integer | Number of actors running.
|
||||
|
||||
<a id="metadataapiresponsecomponent"></a>**Metadata API Response Component**
|
||||
|
||||
Name | Type | Description
|
||||
---- | ---- | -----------
|
||||
name | string | Name of the component.
|
||||
type | string | Component type.
|
||||
version | string | Component version.
|
||||
|
||||
### Examples
|
||||
|
||||
Note: This example is based on the Actor sample provided in the [Dapr SDK for Python](https://github.com/dapr/python-sdk/tree/master/examples/demo_actor).
|
||||
|
||||
```shell
|
||||
curl http://localhost:3500/v1.0/metadata
|
||||
```
|
||||
|
||||
```json
|
||||
{
|
||||
"id":"demo-actor",
|
||||
"actors":[
|
||||
{
|
||||
"type":"DemoActor",
|
||||
"count":1
|
||||
}
|
||||
],
|
||||
"extended": {
|
||||
"cliPID":"1031040",
|
||||
"appCommand":"uvicorn --port 3000 demo_actor_service:app"
|
||||
},
|
||||
"components":[
|
||||
{
|
||||
"name":"pubsub",
|
||||
"type":"pubsub.redis",
|
||||
"version":""
|
||||
},
|
||||
{
|
||||
"name":"statestore",
|
||||
"type":"state.redis",
|
||||
"version":""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## Add a custom attribute to the Dapr sidecar information
|
||||
|
||||
Adds a custom attribute to the Dapr sidecar information stored by the Metadata Endpoint.
|
||||
|
||||
### HTTP Request
|
||||
|
||||
```http
|
||||
PUT http://localhost:<daprPort>/v1.0/metadata/attributeName
|
||||
```
|
||||
|
||||
### URL Parameters
|
||||
|
||||
Parameter | Description
|
||||
--------- | -----------
|
||||
daprPort | The Dapr port.
|
||||
attributeName | Custom attribute name. This is they key name in the key-value pair.
|
||||
|
||||
### HTTP Request Body
|
||||
|
||||
In the request you need to pass the custom attribute value as RAW data:
|
||||
|
||||
```json
|
||||
{
|
||||
"Content-Type": "text/plain"
|
||||
}
|
||||
```
|
||||
|
||||
Within the body of the request place the custom attribute value you want to store:
|
||||
|
||||
```
|
||||
attributeValue
|
||||
```
|
||||
|
||||
### HTTP Response Codes
|
||||
|
||||
Code | Description
|
||||
---- | -----------
|
||||
204 | Custom attribute added to the metadata information
|
||||
|
||||
### Examples
|
||||
|
||||
Note: This example is based on the Actor sample provided in the [Dapr SDK for Python](https://github.com/dapr/python-sdk/tree/master/examples/demo_actor).
|
||||
|
||||
Add a custom attribute to the metadata endpoint:
|
||||
|
||||
```shell
|
||||
curl -X PUT -H "Content-Type: text/plain" --data "myDemoAttributeValue" http://localhost:3500/v1.0/metadata/myDemoAttribute
|
||||
```
|
||||
|
||||
Get the metadata information to confirm your custom attribute was added:
|
||||
|
||||
```json
|
||||
{
|
||||
"id":"demo-actor",
|
||||
"actors":[
|
||||
{
|
||||
"type":"DemoActor",
|
||||
"count":1
|
||||
}
|
||||
],
|
||||
"extended": {
|
||||
"myDemoAttribute": "myDemoAttributeValue",
|
||||
"cliPID":"1031040",
|
||||
"appCommand":"uvicorn --port 3000 demo_actor_service:app"
|
||||
},
|
||||
"components":[
|
||||
{
|
||||
"name":"pubsub",
|
||||
"type":"pubsub.redis",
|
||||
"version":""
|
||||
},
|
||||
{
|
||||
"name":"statestore",
|
||||
"type":"state.redis",
|
||||
"version":""
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
|
||||
|
|
@ -3,7 +3,7 @@ type: docs
|
|||
title: "Secrets API reference"
|
||||
linkTitle: "Secrets API"
|
||||
description: "Detailed documentation on the secrets API"
|
||||
weight: 700
|
||||
weight: 600
|
||||
---
|
||||
|
||||
## Get Secret
|
||||
|
|
|
|||
|
|
@ -26,5 +26,8 @@ dapr components -k
|
|||
|
||||
| Name | Environment Variable | Default | Description
|
||||
| --- | --- | --- | --- |
|
||||
| `--kubernetes`, `-k` | | `false` | List all Dapr configurations in a Kubernetes cluster
|
||||
| `--name`, `-n` | | | The configuration name to be printed (optional)
|
||||
| `--output`, `-o` | | `list`| Output format (options: json or yaml or list)
|
||||
| `--help`, `-h` | | | Print this help message |
|
||||
| `--kubernetes`, `-k` | | `false` | List all Dapr configurations in a Kubernetes cluster |
|
||||
|
|
||||
|
|
|
|||
|
|
@ -1,22 +0,0 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: appconfig
|
||||
namespace: default
|
||||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
---
|
||||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Component
|
||||
metadata:
|
||||
name: native
|
||||
namespace: default
|
||||
spec:
|
||||
type: exporters.native
|
||||
version: v1
|
||||
metadata:
|
||||
- name: enabled
|
||||
value: "true"
|
||||
- name: agentEndpoint
|
||||
value: "otel-collector.default.svc.cluster.local:55678"
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
apiVersion: dapr.io/v1alpha1
|
||||
kind: Configuration
|
||||
metadata:
|
||||
name: appconfig
|
||||
namespace: default
|
||||
spec:
|
||||
tracing:
|
||||
samplingRate: "1"
|
||||
zipkin:
|
||||
endpointAddress: "http://otel-collector.default.svc.cluster.local:9411/api/v2/spans"
|
||||
|
|
@ -8,8 +8,8 @@ metadata:
|
|||
data:
|
||||
otel-collector-config: |
|
||||
receivers:
|
||||
opencensus:
|
||||
endpoint: 0.0.0.0:55678
|
||||
zipkin:
|
||||
endpoint: 0.0.0.0:9411
|
||||
processors:
|
||||
queued_retry:
|
||||
batch:
|
||||
|
|
@ -20,8 +20,9 @@ data:
|
|||
zpages:
|
||||
endpoint: :55679
|
||||
exporters:
|
||||
logging:
|
||||
loglevel: debug
|
||||
azuremonitor:
|
||||
azuremonitor/2:
|
||||
endpoint: "https://dc.services.visualstudio.com/v2/track"
|
||||
instrumentation_key: "<INSTRUMENTATION-KEY>"
|
||||
# maxbatchsize is the maximum number of items that can be
|
||||
|
|
@ -34,8 +35,8 @@ data:
|
|||
extensions: [pprof, zpages, health_check]
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [opencensus]
|
||||
exporters: [azuremonitor/2]
|
||||
receivers: [zipkin]
|
||||
exporters: [azuremonitor,logging]
|
||||
processors: [batch, queued_retry]
|
||||
---
|
||||
apiVersion: v1
|
||||
|
|
@ -47,10 +48,10 @@ metadata:
|
|||
component: otel-collector
|
||||
spec:
|
||||
ports:
|
||||
- name: opencensus # Default endpoint for Opencensus receiver.
|
||||
port: 55678
|
||||
- name: zipkin # Default endpoint for Zipkin receiver.
|
||||
port: 9411
|
||||
protocol: TCP
|
||||
targetPort: 55678
|
||||
targetPort: 9411
|
||||
selector:
|
||||
component: otel-collector
|
||||
---
|
||||
|
|
@ -86,7 +87,7 @@ spec:
|
|||
cpu: 200m
|
||||
memory: 400Mi
|
||||
ports:
|
||||
- containerPort: 55678 # Default endpoint for Opencensus receiver.
|
||||
- containerPort: 9411 # Default endpoint for Zipkin receiver.
|
||||
volumeMounts:
|
||||
- name: otel-collector-config-vol
|
||||
mountPath: /conf
|
||||
|
|
|
|||
Binary file not shown.
|
After Width: | Height: | Size: 650 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 581 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 585 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 213 KiB |
Loading…
Reference in New Issue