mirror of https://github.com/dapr/docs.git
Azure Application Insights fixes (#4660)
Signed-off-by: Alice Gibbons <alice@diagrid.io>
This commit is contained in:
parent
4638f8f3fa
commit
9faf5aedae
|
@ -6,42 +6,42 @@ weight: 1000
|
||||||
description: "How to push trace events to Azure Application Insights, using the OpenTelemetry Collector."
|
description: "How to push trace events to Azure Application Insights, using the OpenTelemetry Collector."
|
||||||
---
|
---
|
||||||
|
|
||||||
Dapr integrates with [OpenTelemetry (OTEL) Collector](https://github.com/open-telemetry/opentelemetry-collector) using the Zipkin API. This guide walks through an example using Dapr to push trace events to Azure Application Insights, using the OpenTelemetry Collector.
|
Dapr integrates with [OpenTelemetry (OTEL) Collector](https://github.com/open-telemetry/opentelemetry-collector) using the OpenTelemetry protocol (OTLP). This guide walks through an example using Dapr to push traces to Azure Application Insights, using the OpenTelemetry Collector.
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- [Install Dapr on Kubernetes]({{< ref kubernetes >}})
|
- [Install Dapr on Kubernetes]({{< ref kubernetes >}})
|
||||||
- [Set up an App Insights resource](https://docs.microsoft.com/azure/azure-monitor/app/create-new-resource) and make note of your App Insights connection string.
|
- [Create an Application Insights resource](https://learn.microsoft.com/azure/azure-monitor/app/create-workspace-resource) and make note of your Application Insights connection string.
|
||||||
|
|
||||||
## Set up OTEL Collector to push to your App Insights instance
|
## Set up OTEL Collector to push to your App Insights instance
|
||||||
|
|
||||||
To push events to your App Insights instance, install the OTEL Collector to your Kubernetes cluster.
|
To push traces to your Application Insights instance, install the OpenTelemetry Collector on your Kubernetes cluster.
|
||||||
|
|
||||||
1. Check out the [`open-telemetry-collector-appinsights.yaml`](/docs/open-telemetry-collector/open-telemetry-collector-appinsights.yaml) file.
|
1. Download and inspect the [`open-telemetry-collector-appinsights.yaml`](/docs/open-telemetry-collector/open-telemetry-collector-appinsights.yaml) file.
|
||||||
|
|
||||||
1. Replace the `<CONNECTION_STRING>` placeholder with your App Insights connection string.
|
1. Replace the `<CONNECTION_STRING>` placeholder with your App Insights connection string.
|
||||||
|
|
||||||
1. Apply the configuration with:
|
1. Deploy the OpenTelemetry Collector into the same namespace where your Dapr-enabled applications are running:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl apply -f open-telemetry-collector-appinsights.yaml
|
kubectl apply -f open-telemetry-collector-appinsights.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Set up Dapr to send trace to OTEL Collector
|
## Set up Dapr to send traces to the OpenTelemetry Collector
|
||||||
|
|
||||||
Set up a Dapr configuration file to turn on tracing and deploy a tracing exporter component that uses the OpenTelemetry Collector.
|
Create a Dapr configuration file to enable tracing and send traces to the OpenTelemetry Collector via [OTLP](https://opentelemetry.io/docs/specs/otel/protocol/).
|
||||||
|
|
||||||
1. Use this [`collector-config.yaml`](/docs/open-telemetry-collector/collector-config.yaml) file to create your own configuration.
|
1. Download and inspect the [`collector-config-otel.yaml`](/docs/open-telemetry-collector/collector-config-otel.yaml). Update the `namespace` and `otel.endpointAddress` values to align with the namespace where your Dapr-enabled applications and OpenTelemetry Collector are deployed.
|
||||||
|
|
||||||
1. Apply the configuration with:
|
1. Apply the configuration with:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
kubectl apply -f collector-config.yaml
|
kubectl apply -f collector-config-otel.yaml
|
||||||
```
|
```
|
||||||
|
|
||||||
## Deploy your app with tracing
|
## Deploy your app with tracing
|
||||||
|
|
||||||
Apply the `appconfig` configuration by adding a `dapr.io/config` annotation to the container that you want to participate in the distributed tracing, as shown in the following example:
|
Apply the `tracing` configuration by adding a `dapr.io/config` annotation to the Dapr applications that you want to include in distributed tracing, as shown in the following example:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
apiVersion: apps/v1
|
apiVersion: apps/v1
|
||||||
|
@ -57,11 +57,11 @@ spec:
|
||||||
dapr.io/enabled: "true"
|
dapr.io/enabled: "true"
|
||||||
dapr.io/app-id: "MyApp"
|
dapr.io/app-id: "MyApp"
|
||||||
dapr.io/app-port: "8080"
|
dapr.io/app-port: "8080"
|
||||||
dapr.io/config: "appconfig"
|
dapr.io/config: "tracing"
|
||||||
```
|
```
|
||||||
|
|
||||||
{{% alert title="Note" color="primary" %}}
|
{{% alert title="Note" color="primary" %}}
|
||||||
If you are using one of the Dapr tutorials, such as [distributed calculator](https://github.com/dapr/quickstarts/tree/master/tutorials/distributed-calculator), the `appconfig` configuration is already configured, so no additional settings are needed.
|
If you are using one of the Dapr tutorials, such as [distributed calculator](https://github.com/dapr/quickstarts/tree/master/tutorials/distributed-calculator), you will need to update the `appconfig` configuration to `tracing`.
|
||||||
{{% /alert %}}
|
{{% /alert %}}
|
||||||
|
|
||||||
You can register multiple tracing exporters at the same time, and the tracing logs are forwarded to all registered exporters.
|
You can register multiple tracing exporters at the same time, and the tracing logs are forwarded to all registered exporters.
|
||||||
|
|
|
@ -2,7 +2,7 @@ apiVersion: dapr.io/v1alpha1
|
||||||
kind: Configuration
|
kind: Configuration
|
||||||
metadata:
|
metadata:
|
||||||
name: appconfig
|
name: appconfig
|
||||||
namespace: default
|
namespace: default # Your app namespace
|
||||||
spec:
|
spec:
|
||||||
tracing:
|
tracing:
|
||||||
samplingRate: "1"
|
samplingRate: "1"
|
||||||
|
|
|
@ -8,10 +8,13 @@ metadata:
|
||||||
data:
|
data:
|
||||||
otel-collector-config: |
|
otel-collector-config: |
|
||||||
receivers:
|
receivers:
|
||||||
zipkin:
|
otlp:
|
||||||
endpoint: 0.0.0.0:9411
|
protocols:
|
||||||
|
grpc:
|
||||||
|
endpoint: ${env:MY_POD_IP}:4317
|
||||||
extensions:
|
extensions:
|
||||||
health_check:
|
health_check:
|
||||||
|
endpoint: :13133
|
||||||
pprof:
|
pprof:
|
||||||
endpoint: :1888
|
endpoint: :1888
|
||||||
zpages:
|
zpages:
|
||||||
|
@ -31,7 +34,7 @@ data:
|
||||||
extensions: [pprof, zpages, health_check]
|
extensions: [pprof, zpages, health_check]
|
||||||
pipelines:
|
pipelines:
|
||||||
traces:
|
traces:
|
||||||
receivers: [zipkin]
|
receivers: [otlp]
|
||||||
exporters: [azuremonitor,debug]
|
exporters: [azuremonitor,debug]
|
||||||
---
|
---
|
||||||
apiVersion: v1
|
apiVersion: v1
|
||||||
|
@ -43,10 +46,10 @@ metadata:
|
||||||
component: otel-collector
|
component: otel-collector
|
||||||
spec:
|
spec:
|
||||||
ports:
|
ports:
|
||||||
- name: zipkin # Default endpoint for Zipkin receiver.
|
- name: otel # Default endpoint for OTEL receiver.
|
||||||
port: 9411
|
port: 4317
|
||||||
protocol: TCP
|
protocol: TCP
|
||||||
targetPort: 9411
|
targetPort: 4317
|
||||||
selector:
|
selector:
|
||||||
component: otel-collector
|
component: otel-collector
|
||||||
---
|
---
|
||||||
|
@ -70,7 +73,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: otel-collector
|
- name: otel-collector
|
||||||
image: otel/opentelemetry-collector-contrib:0.101.0
|
image: otel/opentelemetry-collector-contrib:0.127.0
|
||||||
command:
|
command:
|
||||||
- "/otelcol-contrib"
|
- "/otelcol-contrib"
|
||||||
- "--config=/conf/otel-collector-config.yaml"
|
- "--config=/conf/otel-collector-config.yaml"
|
||||||
|
@ -82,7 +85,13 @@ spec:
|
||||||
cpu: 200m
|
cpu: 200m
|
||||||
memory: 400Mi
|
memory: 400Mi
|
||||||
ports:
|
ports:
|
||||||
- containerPort: 9411 # Default endpoint for Zipkin receiver.
|
- containerPort: 4317 # Default endpoint for OTEL receiver.
|
||||||
|
env:
|
||||||
|
- name: MY_POD_IP
|
||||||
|
valueFrom:
|
||||||
|
fieldRef:
|
||||||
|
apiVersion: v1
|
||||||
|
fieldPath: status.podIP
|
||||||
volumeMounts:
|
volumeMounts:
|
||||||
- name: otel-collector-config-vol
|
- name: otel-collector-config-vol
|
||||||
mountPath: /conf
|
mountPath: /conf
|
||||||
|
|
|
@ -75,7 +75,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: otel-collector
|
- name: otel-collector
|
||||||
image: otel/opentelemetry-collector-contrib-dev:latest
|
image: otel/opentelemetry-collector-contrib:0.127.0
|
||||||
command:
|
command:
|
||||||
- "/otelcontribcol"
|
- "/otelcontribcol"
|
||||||
- "--config=/conf/otel-collector-config.yaml"
|
- "--config=/conf/otel-collector-config.yaml"
|
||||||
|
|
|
@ -78,7 +78,7 @@ spec:
|
||||||
spec:
|
spec:
|
||||||
containers:
|
containers:
|
||||||
- name: otel-collector
|
- name: otel-collector
|
||||||
image: otel/opentelemetry-collector-contrib-dev:latest
|
image: otel/opentelemetry-collector-contrib:0.127.0
|
||||||
command:
|
command:
|
||||||
- "/otelcontribcol"
|
- "/otelcontribcol"
|
||||||
- "--config=/conf/otel-collector-config.yaml"
|
- "--config=/conf/otel-collector-config.yaml"
|
||||||
|
|
Loading…
Reference in New Issue