jianrongzhang89 commented on code in PR #693:
URL: 
https://github.com/apache/incubator-kie-kogito-docs/pull/693#discussion_r1880950026


##########
serverlessworkflow/modules/ROOT/pages/cloud/operator/monitoring-workflows.adoc:
##########
@@ -0,0 +1,332 @@
+= Monitoring Workflows
+:compat-mode!:
+// Metadata:
+:description: Workflows monitoring configuration configuration
+:keywords: kogito, sonataflow, workflow, operator, kubernetes, prometheus, 
grafana
+
+// External pages
+:openshift_enable_monitoring_user_defined_projects_url: 
https://docs.openshift.com/container-platform/4.17/observability/monitoring/enabling-monitoring-for-user-defined-projects.html
+
+:dev_services_url: https://quarkus.io/guides/dev-services
+:test_containers_url: https://www.testcontainers.org/
+
+This document describes how to deploy and configure Prometheus and Grafana 
components for monitoring of {product_name} workflows.
+
+[IMPORTANT]
+====
+Currently, only those {product_name} workflows deployed as Kubernetes 
deployments have workflow related metrics exposed to Prometheus and are hence 
available for monitoring by Grafana Dashboards. Monitoring of {product_name} 
workflows deployed as Knative services is not supported and such serverless 
workflows are not included in the Grafana Dashboards. 
+====
+
+[#deploy-monitoring]
+== Deploy Prometheus and Grafana
+=== Deploy Prometheus and Grafana on OpenShift Container Platform
+==== Deploy Prometheus
+OpenShift Container Platform includes a preconfigured, preinstalled, and 
self-updating monitoring stack that provides monitoring for core platform 
components. As such the Prometheus Operator is already installed on the 
cluster. To monitor SonataFlow workflows, you shall enable monitoring for 
user-defined projects. This is achieved by updating `cluster-monitoring-config` 
ConfigMap in the openshift-monitoring namespace. Create a new one if the 
ConfigMap does not exist.
+[source, yaml]
+----
+cat << EOF | oc apply -f -
+apiVersion: v1
+kind: ConfigMap
+metadata:
+  name: cluster-monitoring-config
+  namespace: openshift-monitoring
+data:
+  config.yaml: |
+    enableUserWorkload: true
+EOF
+----
+A new Prometheus server pod will be started and running in the namespace 
`openshift-user-workload-monitoring`.
+
+==== Deploy Grafana
+===== Deploy Grafana Operator
+Create a namespace for the Grafana Operator to be installed in
+[source,shell,subs="attributes+"]
+----
+oc new-project grafana-operator
+----
+Deploy the Grafana Operator using command line. You can also deploy the 
operator through OperatorHub.
+[source,shell,subs="attributes+"]
+----
+cat << EOF | oc create -f -
+apiVersion: operators.coreos.com/v1
+kind: OperatorGroup
+metadata:
+  generateName: grafana-operator-
+  namespace: grafana-operator
+spec:
+  targetNamespaces:
+  - grafana-operator
+---
+apiVersion: operators.coreos.com/v1alpha1
+kind: Subscription
+metadata:
+  generateName: grafana-operator-
+  namespace: grafana-operator
+spec:
+  channel: v5
+  name: grafana-operator
+  installPlanApproval: Automatic
+  source: community-operators
+  sourceNamespace: openshift-marketplace
+EOF
+----
+Wait for the Operator to be ready
+[source,shell,subs="attributes+"]
+----
+oc -n grafana-operator rollout status \
+  deployment grafana-operator-controller-manager-v5
+----
+===== Deploy Grafana Instance
+[source, yaml]
+----
+cat << EOF | oc create -f -
+apiVersion: grafana.integreatly.org/v1beta1
+kind: Grafana
+metadata:
+  name: grafana
+  labels:
+    dashboards: "grafana"
+spec:
+  config:
+    security:
+      admin_user: root
+      admin_password: secret
+EOF
+----
+===== Give the Grafana service account the cluster-monitoring-view role
+[source, yaml]
+----
+oc adm policy add-cluster-role-to-user cluster-monitoring-view -z grafana-sa
+----
+===== Generate a bearer token for the grafana service account 
+[source, yaml]
+----
+TOKEN=`oc sa new-token grafana-sa`
+----
+===== Deploy the Prometheus Data Source 
+[source, yaml]
+----
+cat << EOF | oc create -f -
+apiVersion: grafana.integreatly.org/v1beta1
+kind: GrafanaDatasource
+metadata:
+  name: example-grafanadatasource
+spec:
+  datasource:
+    access: proxy
+    isDefault: true
+    type: prometheus
+    jsonData:
+      httpHeaderName1: 'Authorization'
+      timeInterval: 5s
+      tlsSkipVerify: true
+    secureJsonData:
+        httpHeaderValue1: 'Bearer ${TOKEN}'
+    name: Prometheus
+    url: https://thanos-querier.openshift-monitoring.svc.cluster.local:9091

Review Comment:
   That's correct: the metrics are exposed to Prometheus but are not available 
in Grafana.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to