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
Copy file name to clipboardExpand all lines: metrics-collector/README.md
+80-1Lines changed: 80 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -184,9 +184,88 @@ The following 3 metrics are used to monitor the collector itself:
184
184
#### Metric Labels
185
185
186
186
All container metrics include the following labels:
187
-
- `ibm_codeengine_instance_name`: Name of the pod instance
188
187
- `ibm_codeengine_component_type`: Type of component (`app`, `job`, or `build`)
189
188
- `ibm_codeengine_component_name`: Name of the Code Engine component
189
+
- `ibm_codeengine_instance_name`: Name of the pod instance (optional, see cardinality control below)
190
+
- `ibm_codeengine_subcomponent_name`: Name of the app revision (optional, see cardinality control below)
191
+
192
+
#### User Metrics Scraping
193
+
194
+
The metrics collector can automatically discover and scrape custom Prometheus metrics from your Code Engine applications. To enable this feature, add the following annotations to your application:
195
+
196
+
**Required annotation:**
197
+
- `codeengine.cloud.ibm.com/userMetricsScrape: 'true'` - Enables metrics scraping for this application
To manage metric cardinality and reduce costs, you can control which labels are included in scraped user metrics using the following annotations:
223
+
224
+
**Cardinality control annotations:**
225
+
- `codeengine.cloud.ibm.com/userMetricsInstance: 'true'` - Include the `ibm_codeengine_instance_name` label (pod name)
226
+
- `codeengine.cloud.ibm.com/userMetricsSubcomponent: 'true'` - Include the `ibm_codeengine_subcomponent_name` label (app revision name)
227
+
228
+
**Default behavior:** By default, both `ibm_codeengine_instance_name` and `ibm_codeengine_subcomponent_name` labels are **excluded** from user metrics to minimize cardinality. These labels can create high cardinality because:
229
+
- Instance names change with each pod restart or scale event
230
+
- Revision names change with each application update
231
+
232
+
**When to enable these labels:**
233
+
- Enable `userMetricsInstance` when you need to track metrics per individual pod instance
234
+
- Enable `userMetricsSubcomponent` when you need to compare metrics across different application revisions
235
+
236
+
**Example with cardinality control:**
237
+
```bash
238
+
# Enable user metrics scraping with instance-level granularity
**Note:** Only set these annotations to `'true'` when you specifically need the additional label granularity. Keeping them disabled (default) helps reduce metric cardinality and associated monitoring costs.
0 commit comments