couchdb
couchdb copied to clipboard
easy enablement for prometheus related feature
Summary
Easy enablement for prometheus feature by environment variables
Desired Behaviour
For sample as COUCHDB_USER
, as a user, I want to enable prometheus related feature by environment value as
[prometheus]
additional_port = false
bind_address = 127.0.0.1
port = 17986
prometheus_additional_port
prometheus_bind_address
prometheus_port
Possible Solution
Not sure if https://github.com/apache/couchdb/blob/main/configure#L247 this line is useless. if not, take prometheus_port as sample:
{prometheus_port, $prometheus_port}
and in rel/overlay/etc/default.ini
[prometheus]
additional_port = false
bind_address = 127.0.0.1
port = {{prometheus_port}}
Additional context
N/A
as so far, with default value as configuration. access:
/tmp % curl 127.0.0.1:5984/_node/_local/_prometheus
{"error":"unauthorized","reason":"You are not a server admin or read-only metrics user"}
related with https://github.com/apache/couchdb/discussions/3935
I can understand we want to disable the prometheus by default, but... as current status, the prometheus seems enabled at port 5984, and blocked prometheus as prometheus operator to access it. are we want it disabled by default? or we'd better have a fixable configuration to control this feature enablement?
with my hands on, I am confusing.
attachment my yaml file for reference.
---
apiVersion: v1
kind: Service
metadata:
name: org1peer1couchdb
spec:
selector:
app: org1peer1couchdb
ports:
- name: couchport
port: 5984
protocol: TCP
- name: matrix
port: 17986
protocol: TCP
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: org1peer1couchdb
spec:
replicas: 1
selector:
matchLabels:
app: org1peer1couchdb
template:
metadata:
labels:
app: org1peer1couchdb
spec:
containers:
- name: couchdb
image: couchdb:3.2
imagePullPolicy: IfNotPresent
env:
- name: "COUCHDB_USER"
value: "admin"
- name: "COUCHDB_PASSWORD"
value: "adminpw"
- name: "PROMETHEUS_ADDITIONAL_PORT" # useless so far
value: "true"
- name: "PROMETHEUS_BIND_ADDRESS" # useless so far
value: "0.0.0.0"
- name: "PROMETHEUS_PORT" # useless so far
value: "17986"
ports:
- containerPort: 5984
- containerPort: 17986
---
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
name: org1peer1couchdb
namespace: default
labels:
release: mypro
spec:
namespaceSelector:
matchNames:
- default
selector:
matchLabels:
app: org1peer1couchdb
endpoints:
- port: couchport
path: /_node/_local/_prometheus