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
This change decouples the metrics collection and scraping, and allows custom scrapers.
The default scraper stays the osiris one, using the auto-injected sidecar container.
And we introduce a new scraper, using the prometheus format. It doesn't require the osiris proxy,
and instead scrap metrics from a application-provided prometheus-compliant endpoint.
see deislabs#48 for more details
Copy file name to clipboardExpand all lines: README.md
+44
Original file line number
Diff line number
Diff line change
@@ -187,6 +187,7 @@ The following table lists the supported annotations for Kubernetes `Deployments`
187
187
|`osiris.deislabs.io/enabled`| Enable the zeroscaler component to scrape and analyze metrics from the deployment's pods and scale the deployment to zero when idle. Allowed values: `y`, `yes`, `true`, `on`, `1`. |_no value_ (= disabled) |
188
188
|`osiris.deislabs.io/minReplicas`| The minimum number of replicas to set on the deployment when Osiris will scale up. If you set `2`, Osiris will scale the deployment from `0` to `2` replicas directly. Osiris won't collect metrics from deployments which have more than `minReplicas` replicas - to avoid useless collections of metrics. |`1`|
189
189
|`osiris.deislabs.io/metricsCheckInterval`| The interval in which Osiris would repeatedly track the pod http request metrics. The value is the number of seconds of the interval. Note that this value override the global value defined by the `zeroscaler.metricsCheckInterval` Helm value. |_value of the `zeroscaler.metricsCheckInterval` Helm value_|
190
+
|`osiris.deislabs.io/metricsCollector`| Configure the collection of metrics for a deployment's pods. The value is a JSON object with at least a `type` string, and an optional `implementation` object. See the *Metrics Scraping* section for more. |`{ "type": "osiris" }`|
190
191
191
192
#### Pod Annotations
192
193
@@ -212,6 +213,49 @@ The following table lists the supported annotations for Kubernetes `Services` an
212
213
213
214
Note that you might see an `osiris.deislabs.io/selector` annotation - this is for internal use only, and you shouldn't try to set/update or delete it.
214
215
216
+
#### Metrics Scraping Configuration
217
+
218
+
Scraping the metrics from the pods is done automatically using Osiris provided sidecar container by default. But if you don't want to use the auto-injected sidecar container, you can also configure a custom metrics scraper, using the `osiris.deislabs.io/metricsCollector` annotation on your deployment.
219
+
220
+
The following scrapers are supported:
221
+
222
+
**osiris**
223
+
224
+
This is the default scraper, which doesn't need any configuration.
225
+
226
+
**prometheus**
227
+
228
+
The prometheus scraper retrieves metrics about the opened & closed connections from your own prometheus endpoint. To use it, your application need to expose an endpoint with metrics in the prometheus format.
229
+
You can then set the following annotation:
230
+
231
+
```
232
+
annotations:
233
+
osiris.deislabs.io/metricsCollector: |
234
+
{
235
+
"type": "prometheus",
236
+
"implementation": {
237
+
"port": 8080,
238
+
"path": "/metrics",
239
+
"openedConnectionsMetricName": "connections",
240
+
"openedConnectionsMetricLabels": {
241
+
"type": "opened"
242
+
},
243
+
"closedConnectionsMetricName": "connections",
244
+
"closedConnectionsMetricLabels": {
245
+
"type": "closed"
246
+
}
247
+
}
248
+
}
249
+
```
250
+
251
+
The schema of the prometheus implementation configuration is:
252
+
- a mandatory `port` integer
253
+
- an optional `path` string - default to `/metrics` if not set
254
+
- a mandatory `openedConnectionsMetricName` string, for the name of the metric that expose the number of opened connections
255
+
- a mandatory `closedConnectionsMetricName` string, for the name of the metric that expose the number of closed connections
256
+
- an optional `openedConnectionsMetricLabels` object, for all labels that should match the metric for opened connections
257
+
- an optional `closedConnectionsMetricLabels` object, for all labels that should match the metric for closed connections
258
+
215
259
### Demo
216
260
217
261
Deploy the [example application](example/hello-osiris.yaml)`hello-osiris` :
0 commit comments