Skip to content

Commit

Permalink
disk usage statistics are off by default
Browse files Browse the repository at this point in the history
  • Loading branch information
reggeenr committed Sep 2, 2024
1 parent c863e52 commit ea5116f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 7 additions & 1 deletion metrics-collector/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ $ ibmcloud ce subscription cron create \
--schedule '*/1 * * * *'
```

## Configuration

Per default the metrics collector collects memory and CPU statistics, like `usage`, `current` and `configured`.

One can use the environment variable `COLLECT_DISKUSAGE=true` to also collect the amount of disk space that is used. Please note, the metrics collector can only calculate the overall file size stored in the pods filesystem which includes files that are part of the container image, the ephermal storage as well as mounted COS buckets. Hence, this metric cannot be used to calculate the ephemeral storage usage.

## IBM Cloud Logs setup

Once your IBM Cloud Code Engine project has detected a corresponding IBM Cloud Logs instance, which is configured to receive platform logs, you can consume the resource metrics in IBM Cloud Logs. Use the filter `metric:instance-resources` to filter for log lines that print resource metrics for each detected IBM Cloud Code Engine instance that is running in a project.
Expand All @@ -57,7 +63,7 @@ Along with a human readable message, like `Captured metrics of app instance 'loa

E.g.
- `cpu.usage:>80`: Filter for all log lines that noticed a CPU utilization of 80% or higher
- `memory-current:>1000`: Filter for all log lines that noticed an instance that used 1GB or higher of memory
- `memory.current:>1000`: Filter for all log lines that noticed an instance that used 1GB or higher of memory
- `component_type:app`: Filter only for app instances. Possible values are `app`, `job`, and `build`
- `component_name:<app-name>`: Filter for all instances of a specific app, job, or build
- `name:<instance-name>`: Filter for a specific instance
Expand Down
3 changes: 2 additions & 1 deletion metrics-collector/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,8 @@ func getAllPods(coreClientset *kubernetes.Clientset, namespace string, config *r
func obtainDiskUsage(coreClientset *kubernetes.Clientset, namespace string, pod string, container string, config *rest.Config) float64 {
// fmt.Println("obtainDiskUsage > pod: '" + pod + "', container: '" + container + "'")

if os.Getenv("SKIP_DISKUSAGE") == "true" {
// per default, we do not collect disk space statistics
if os.Getenv("COLLECT_DISKUSAGE") != "true" {
return 0
}

Expand Down

0 comments on commit ea5116f

Please sign in to comment.