You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
65
65
66
66
There are three things you need to do:
67
67
@@ -74,9 +74,7 @@ To enable the Azure Monitor integration, you need to add a new resource **Applic
When the resource finishes creating, **save the Instrumentation Key** or **Connection String** for later usage.
80
78
81
79
### Starting the OpenTelemetry Collector
82
80
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:
98
96
volumes:
99
97
- ./otel-collector.yaml:/etc/otel-collector.yaml
100
98
ports:
101
-
- "55678"
99
+
- "4317"
100
+
- "4318"
102
101
```
103
102
104
103
The configuration mounted for the collector is below, `otel-collector.yaml`:
105
104
106
105
```yaml
107
106
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"
109
113
110
114
exporters:
111
115
# logging:
112
116
# verbosity: detailed
113
117
azuremonitor:
114
-
instrumentation_key: XXXXXXX
118
+
connection_string: XXXXXXX
115
119
116
120
service:
117
121
telemetry:
118
122
logs:
119
123
level: "warn"
120
124
pipelines:
121
125
traces:
122
-
receivers: [opencensus]
126
+
receivers: [otlp]
123
127
exporters: [azuremonitor]
124
128
```
125
129
Enable the logging only if you find problems and want extra information.
126
130
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.
128
132
129
133
### Configuration for KrakenD
130
134
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:
133
137
{
134
138
"version": 3,
135
139
"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
146
148
}
149
+
]
147
150
}
151
+
}
148
152
}
149
153
}
150
154
```
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
+
151
157
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.
152
158
153
159
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.
154
160
155
161
{{< 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.
0 commit comments