The main aim in this exercise is to expose the Data Virtualization servie metrics that was deployed in the previous steps using Prometheus.
the Teiid Operator will automatically find the Prometheus instance in the cluster based on the matching labels configured as "team=middleware", which are default labels that Teiid Operator is configured to scan with.
serviceMonitorSelector:
matchLabels:
team: middleware
If Teiid Operator is needs to scan on different matching labels, configure a environment property "PROMETHEUS_MONITOR_LABEL_KEY" and "PROMETHEUS_MONITOR_LABEL_VALUE". For example
PROMETHEUS_MONITOR_LABEL_KEY=foo PROMETHEUS_MONITOR_LABEL_VALUE=bar
on the operator deployment environment properties.
Note
|
The operator automatically adds the configuration for metrics that it going to expose for given virtualization. However, if user wants expose different set of metrics they can provide a config-map with name teiid-prometheus-config with key called rules and then provide the full rules in yaml content in there. During the deployment if Operator finds existence of this config-map then it will use it for prometheus configuration instead of default one.
|
Note that in this example, the installation of Prometheus is done using using a Prometheus Operator.
Note
|
Installing the Operator and the Prometheus instance is only for testing purposes. In production scenarios there should be common Prometheus installed for set of applications that every service uses. |
TODO - start with https://github.com/coreos/prometheus-operator there are several options including a helm chart.
For convenience the Operator install YAML file included here, which will install the Prometheus Operator in myproject
namespace. In order to install the user needs to have cluster admin permissions.
# login as admin user, or user with cluster admin permissions
oc login
# install the operator in myproject namespace (edit to place in different namespace)
oc create -f prometheus-operator.yaml
# create a Prometheus server in "myproject" namespace (edit to place in different namespace)
oc create -f prometheus-server.yaml
Once the above is installed, the Teiid Operator will automatically find the Prometheus instance based on the matching labels configured "team=dv", which are default labels that Teiid Operator is configured to scan with.
serviceMonitorSelector:
matchLabels:
team: dv
Once the Prometheus instance is found, Teiid Operator automatically configures the ServiceMonitor
to capture the metrics.