Skip to content

Commit f85a49e

Browse files
authored
Merge pull request #116 from oracle-quickstart/ape
New feature 'Automatic Prometheus Collection' and upgrade agent image to version 1.9
2 parents e21ab33 + 8fe5c66 commit f85a49e

File tree

11 files changed

+104
-5
lines changed

11 files changed

+104
-5
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Change Log
22

3+
4+
# 2025-08-13
5+
### Added
6+
- New feature 'Automatic Prometheus Collection' in Management Agent. This enables agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the Prometheus configuration to collect metrics.
7+
8+
## Changed
9+
- Management Agent container image has been updated to version 1.9.0
10+
311
# 2025-08-12
412
### Changed
513
- Fluentd collector container image has been updated to version 1.7.1

charts/mgmt-agent/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 3.0.4
21+
version: 3.0.5
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to

charts/mgmt-agent/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ A Helm chart for collecting Kubernetes Metrics using OCI Management Agent into O
2525
| kubernetesCluster.overrideAllowMetricsCluster | string | `nil` | Provide the specific list of comma separated metric names for agent computed metrics to be collected |
2626
| kubernetesCluster.overrideAllowMetricsKubelet | string | `nil` | Provide the specific list of comma separated metric names for Kubelet (/api/v1/nodes/<node_name>/proxy/metrics) metrics to be collected |
2727
| kubernetesCluster.overrideAllowMetricsNode | string | `nil` | Provide the specific list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics to be collected |
28+
| kubernetesCluster.enableAutomaticPrometheusDetection | bool | `false` | Setting this to true will enable automatic PrometheusEmitter metrics collection from eligible pods |
2829
| mgmtagent.image.secret | string | `nil` | Image secrets to use for pulling container image (base64 encoded content of ~/.docker/config.json file) |
2930
| mgmtagent.image.url | string | `nil` | Replace this value with actual docker image URL for Management Agent |
3031
| mgmtagent.installKey | string | `"resources/input.rsp"` | Copy the downloaded Management Agent Install Key file under root helm directory as resources/input.rsp |
Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# 1. Introduction
2+
Automatic Prometheus collection allows the Agent to automatically find and identify metrics emitting pods to monitor, eliminating the need to manually create the Prometheus configuration to collect metrics.
3+
4+
# 2. Identification of metric collection configuration
5+
6+
## 2.1 Out of the box
7+
Management Agent has capabilities to detect metrics emitting pods, without making any custom configuration changes.
8+
9+
### 2.1.1 Pod' ports specification
10+
Management Agent will look for pod port spec with port name as `metrics` and port protocol as `TCP`.</br>
11+
Once found, the configuration is build using default path as `/metrics`. The rest of the configuration is set to default as well.
12+
13+
### 2.1.2 Prometheus.io Annotation
14+
Deployments using industry standard prometheus.io annotations to enable scrapping, will be automatically detected out of the box by agent.</br>
15+
The pod's ports specification configuration can be modified using the standardized prometheus.io annotations.</br>
16+
17+
### Sample annotation
18+
```
19+
annotations:
20+
prometheus.io/path: "/path/to/metrics"
21+
prometheus.io/port: "8080"
22+
prometheus.io/scrape: "true"
23+
```
24+
Agent will only scrape if `prometheus.io/scrape` is set to `true`.</br>
25+
The `prometheus.io/path` is optional, if not set, then it will default to `/metrics`. The rest of the configuration is set to default as well.
26+
27+
## 2.2. prometheus scrape config json
28+
The configuration can be fine tuned by providing custom json in [prometheus-scrape-config.json](./prometheus-scrape-config.json). This exposes all available PrometheusEmitter parameters.</br>
29+
Json takes highest precedence and overrides other types (annotation and out of the box)</br>
30+
If a pod matches multiple configs, then the last matching config will be applied.
31+
32+
### 2.2.1 Sample JSON with all supported parameters (including optional)
33+
```
34+
[
35+
{
36+
"podMatcher":
37+
{
38+
"namespaceRegex": "pod_namespace.*",
39+
"podNameRegex": "sample-pod.*"
40+
},
41+
"config":
42+
{
43+
"path": "/path/to/metrics/endpoint",
44+
"port": 9100,
45+
"namespace": "push_metrics_to_namespace",
46+
"allowMetrics": "sampleMetric1,sampleMetric2",
47+
"compartmentId": "ocid1.compartment.oc1..sample",
48+
"scheduleMins": 1
49+
},
50+
"disable": false
51+
},
52+
...
53+
]
54+
```
55+
56+
### 2.2.2 First class members
57+
| member | required | description |
58+
|--------|----------|-------------|
59+
| podMatcher | yes | Elements used to match pods |
60+
| config | no | Collection configuration for PrometheusEmitter data source of the matching pod. This is optional, if disable is set to `true` |
61+
| disable | no | This is optional and defaults to `false`. If set to `true`, then podMatcher is used to restrict matching pods from collecting PrometheusEmitter metrics |
62+
63+
### 2.2.3 podMatcher
64+
| member | required | type | description |
65+
|--------|----------|----- | ------------|
66+
| namespaceRegex | yes | `string` | Complete regular expression to match pod's namespace |
67+
| podNameRegex | yes | `string` | Complete regular expression to match pod's name |
68+
69+
### 2.2.4 config
70+
| member | required | type | default | description |
71+
|--------|----------|----- | ------- | ----------- |
72+
| path | no | `string` | /metrics | Path on which metrics are being emitted, e.g. /metrics |
73+
| port | yes | `int` | NA | Port on which metrics are being emitted |
74+
| namespace | no | `string` | pod_prometheus_emitters | OCI namespace to which metrics are pushed |
75+
| allowMetrics | no | `string` | * | Comma separated metrics allowed to be collected. Defaults to *, which means all |
76+
| compartmentId | no | `string` | Agent's compartmentId | Compartment to which metrics are pushed. If not provided, then metrics will be pushed to same compartment where agent is installed |
77+
| scheduleMins | no | `int` | 1 | Minute interval at which metrics are collected |
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[
2+
]

charts/mgmt-agent/templates/env-configmap.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@ data:
1515
{{- if .Values.deployment.cleanupEpochTime }}
1616
POD_CLEANUP_ID: "{{ .Values.deployment.cleanupEpochTime }}"
1717
{{- end }}
18+
ENABLE_AUTOMATIC_PROMETHEUS_DETECTION: "{{ .Values.kubernetesCluster.enableAutomaticPrometheusDetection }}"

charts/mgmt-agent/templates/metrics-configmap.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,3 +34,5 @@ data:
3434
# list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics
3535
overrideAllowMetricsNode={{ .Values.kubernetesCluster.overrideAllowMetricsNode }}
3636
{{- end }}
37+
prometheus-scrape-config.json: |
38+
{{ .Files.Get "resources/prometheus-scrape-config.json" | indent 4 }}

charts/mgmt-agent/values.schema.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,11 +131,16 @@
131131
"type": "null"
132132
}
133133
]
134+
},
135+
"enableAutomaticPrometheusDetection":
136+
{
137+
"type": "boolean"
134138
}
135139
},
136140
"required":
137141
[
138-
"namespace"
142+
"namespace",
143+
"enableAutomaticPrometheusDetection"
139144
]
140145
},
141146
"deployment":

charts/mgmt-agent/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,9 @@ kubernetesCluster:
6767
overrideAllowMetricsKubelet:
6868
# -- Provide the specific list of comma separated metric names for Node (/api/v1/nodes/<node_name>/proxy/metrics/resource, /api/v1/nodes/<node_name>/proxy/metrics/cadvisor) metrics to be collected.
6969
overrideAllowMetricsNode:
70+
# Setting this to true will automatically enable PrometheusEmitter metrics collection for eligible pods.
71+
# To customize and get more information, refer ./resources/auto_prometheus_collection_readme.md
72+
enableAutomaticPrometheusDetection: false
7073

7174
deployment:
7275
security:

charts/oci-onm/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ type: application
1818
# This is the chart version. This version number should be incremented each time you make changes
1919
# to the chart and its templates, including the app version.
2020
# Versions are expected to follow Semantic Versioning (https://semver.org/)
21-
version: 4.0.1
21+
version: 4.0.2
2222

2323
# This is the version number of the application being deployed. This version number should be
2424
# incremented each time you make changes to the application. Versions are not expected to
@@ -36,6 +36,6 @@ dependencies:
3636
repository: "file://../logan"
3737
condition: oci-onm-logan.enabled
3838
- name: oci-onm-mgmt-agent
39-
version: "3.0.4"
39+
version: "3.0.5"
4040
repository: "file://../mgmt-agent"
4141
condition: oci-onm-mgmt-agent.enabled

0 commit comments

Comments
 (0)