Observability

As a Red Hat Developer Hub administrator, you can track user activities, system events, and data changes with Developer Hub audit logs. Administrators can view, search, filter, and manage the log data from the Red Hat OpenShift Container Platform web console

Monitoring and logging

In OpenShift Container Platform, metrics are exposed through an HTTP service endpoint under the /metrics canonical name. You can create a ServiceMonitor custom resource (CR) to scrape metrics from a service endpoint in a user-defined project.

Setup monitoring for user-defined projects

As a first step, you will need to create the cluster-monitoring-config ConfigMap object:

  1. Navigate to the OpenShift console. You can login as admin/{common_password}

  2. Click the (+) button on the top navbar on OpenShift to create this ConfigMap create yaml

  3. Copy the following ConfigMap and paste it into the YAML editor. In this configMap, when the enableUserWorkload parameter is set to true, it enables monitoring for user-defined projects in an OpenShift cluster.

    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: cluster-monitoring-config
      namespace: openshift-monitoring
    data:
      config.yaml: |
        enableUserWorkload: true
  4. Click the Save button.

    save user workload

Enable metrics monitoring on OpenShift

In this step we will enable the metrics monitoring on Red Hat Developer Hub

  1. Open your values.yaml file.

  2. Select Edit > Edit single file. When prompted, login as a Platform Engineer with pe1/{common_password}

  3. Find the YAML surrounded by --- MONITORING --- and uncomment it by highlighting it and pressing CMD + / or CTRL + /.

    uncomment monitoring

Refresh the backstage ArgoCD app for this change to take effect

  1. Click Refresh on the backstage Application in OpenShift GitOps. If prompted, login as admin/{openshift_gitops_password}.

  2. Wait until the Application reports being in a Healthy state.

  3. You can see that a new servicemonitor has been created for Red Hat Developer Hub, which can be viewed by navigating to the backstage ArgoCD app.

    new service monitor

View Red Hat Developer Hub metrics on OpenShift

You can view the Red Hat Developer Hub’s metrics from the Developer perspective of the OpenShift web console within the backstage namespace

  1. Visit the metrics page to view this Observe menu on OpenShift

  2. Click the Metrics tab, and from the Select query drop down, choose Custom query

    select custom query

  3. You can query a number of parameters by entering a query into the the Expression text area,

    expression area
    1. Enter catalog_entities_count into the textarea and hit Enter to view metrics such as how many components, users, templates etc are present in the

      catalog entities count

    2. scaffolder_task_count results in the count and user details

      scaffolder task count

    3. Other examples are scaffolder_step_count, scaffolder_task_count can yield interesting info about the template usage as well. The below screenshot shows output for scaffolder_step_count

      scaffolder task count
  4. You can leverage the metrics to build custom Grafana dashboards to visualise them as well.

Audit logging and Telemetry

You can track user activities, system events, and data changes with Developer Hub audit logs. Telemetry data collection supports collecting and analyzing telemetry data to enhance Red Hat Developer Hub experience.

These sections are outside the scope of this workshop, but you can learn amore about it in Red Hat Developer Hub’s product documentation under the Observability section.