Skip to content

Commit 8efe400

Browse files
authored
Merge pull request #269 from krakend/correct_azure
Correct Azure documentation to use OpenTelemetry
2 parents 812d435 + 0625119 commit 8efe400

1 file changed

Lines changed: 30 additions & 24 deletions

File tree

telemetry/azure.md

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
lastmod: 2022-12-07
2+
lastmod: 2025-08-21
33
date: 2020-11-16
44
linktitle: Azure Monitor
55
title: Azure Monitor Telemetry Integration
@@ -10,13 +10,13 @@ menu:
1010
parent: "160 Monitoring, Logs, and Analytics"
1111
meta:
1212
since: 1.1
13-
source: https://github.com/krakend/krakend-opencensus
13+
source: https://github.com/krakend/krakend-otel
1414
namespace:
15-
- telemetry/opencensus
15+
- telemetry/opentelemetry
1616
scope:
1717
- service
1818
log_prefix:
19-
- "[SERVICE: Opencensus]"
19+
- "[SERVICE: OpenTelemetry]"
2020
skip_header_image: true
2121
images:
2222
- /images/documentation/screenshots/azure-app-insights-1.png
@@ -61,7 +61,7 @@ The gateway sends all the traces to a local **OpenTelemetry Collector** ([see re
6161
![Otel collector](/images/documentation/diagrams/azure-collector.mmd.svg)
6262

6363
## Application Insights configuration
64-
The [OpenCensus exporter](/docs/telemetry/opencensus/) is the (stable) component that allows you to export telemetry data, Azure included. Nevertheless, the official **OpenTelemetry Collector** is flagged as **beta** and still **does not support pushing metrics** for Azure. So without further development on the OpenTelemetry side, the integration is limited to traces.
64+
OpenTelemetry allows you to export telemetry data, Azure included. Nevertheless, the official **OpenTelemetry Collector** is flagged as **beta** and still **does not support pushing metrics** for Azure. So without further development on the OpenTelemetry side, the integration is limited to traces.
6565

6666
There are three things you need to do:
6767

@@ -74,9 +74,7 @@ To enable the Azure Monitor integration, you need to add a new resource **Applic
7474

7575
![Application Insights](/images/documentation/screenshots/azure-application-insights.png)
7676

77-
When the resource finishes creating, **save the Instrumentation Key** for later usage, you will find it as shown in the screenshot below:
78-
79-
![Application Insights](/images/documentation/screenshots/azure-application-insights-instrumentation-key.png)
77+
When the resource finishes creating, **save the Instrumentation Key** or **Connection String** for later usage.
8078

8179
### Starting the OpenTelemetry Collector
8280
You can start the OpenTelemetry Collector with Azure's compatibility using its [Docker image](https://hub.docker.com/r/otel/opentelemetry-collector-contrib). Here there is a `docker-compose.yml` example that includes a KrakenD and a collector:
@@ -98,33 +96,39 @@ services:
9896
volumes:
9997
- ./otel-collector.yaml:/etc/otel-collector.yaml
10098
ports:
101-
- "55678"
99+
- "4317"
100+
- "4318"
102101
```
103102
104103
The configuration mounted for the collector is below, `otel-collector.yaml`:
105104

106105
```yaml
107106
receivers:
108-
opencensus:
107+
otlp:
108+
protocols:
109+
grpc:
110+
endpoint: "0.0.0.0:4317"
111+
http:
112+
endpoint: "0.0.0.0:4318"
109113
110114
exporters:
111115
# logging:
112116
# verbosity: detailed
113117
azuremonitor:
114-
instrumentation_key: XXXXXXX
118+
connection_string: XXXXXXX
115119
116120
service:
117121
telemetry:
118122
logs:
119123
level: "warn"
120124
pipelines:
121125
traces:
122-
receivers: [opencensus]
126+
receivers: [otlp]
123127
exporters: [azuremonitor]
124128
```
125129
Enable the logging only if you find problems and want extra information.
126130

127-
Replace the value of the `instrumentation_key` entry with the one you got in your Azure dashboard.
131+
Replace the value of the `connection_string` entry with the one you got in your Azure dashboard.
128132

129133
### Configuration for KrakenD
130134
Lastly, add at the service level of KrakenD the following configuration:
@@ -133,27 +137,29 @@ Lastly, add at the service level of KrakenD the following configuration:
133137
{
134138
"version": 3,
135139
"extra_config": {
136-
"telemetry/opencensus": {
137-
"sample_rate": 100,
138-
"reporting_period": 60,
139-
"exporters": {
140-
"ocagent": {
141-
"address": "otel-collector:55678",
142-
"service_name": "myKrakenD",
143-
"@comment": "Connection to the internal collector is rarely under SSL (insecure flag)",
144-
"insecure": true
145-
}
140+
"telemetry/opentelemetry": {
141+
"trace_sample_rate": 1,
142+
"exporters": {
143+
"otlp": [
144+
{
145+
"name": "azure_monitor",
146+
"host": "localhost",
147+
"port": 4317
146148
}
149+
]
147150
}
151+
}
148152
}
149153
}
150154
```
155+
The configuration above reports a 100% of the activity (`trace_sample_rate = 1`), when in production consider lowering this value (e.g., `0.1`) as you will want a sample of the traffic only.
156+
151157
The `otel-collector` above is the name of the docker compose service running the collector. You might need to replace it if you are not using this example.
152158

153159
With these three steps, you can start sending data to KrakenD. You should start seeing the graphs populated on Azure Monitor in a couple of minutes.
154160

155161
{{< note title="Insecure flag" type="warning" >}}
156-
Most of the times, the communication between KrakenD and the collector happens in the same machine. It is rare that this connection uses SSL, and if it doesn't the `insecure` flag must be set to `true`. Otherwise, KrakenD will fail silently.
162+
Most of the times, the communication between KrakenD and the collector happens in the same machine. It is rare that this connection uses SSL, and if it doesn't, the `insecure` flag must be set to `true`. Otherwise, KrakenD will fail silently.
157163
{{< /note >}}
158164

159165

0 commit comments

Comments
 (0)