Observability

As a Platform Engineer and Red Hat Developer Hub administrator, you can track user activities, system events, and data changes with Developer Hub audit logs. These logs are accessible through the Red Hat OpenShift Container Platform web console, where administrators can view, search, filter, and manage log data.

Monitoring and logging

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

Set up monitoring for user-defined projects

To begin, create create the cluster-monitoring-config ConfigMap object:

  1. Navigate to the OpenShift console. Login as admin/{common_password} if prompted.

  2. Click the (+) button on the top navigation bar of OpenShift Console to create a new resource. create yaml

  3. In the YAML editor, input the following ConfigMap. Setting the enableUserWorkload parameter to true, enables monitoring of user-defined projects in the OpenShift cluster.

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

    save user workload

Enable metrics monitoring on OpenShift

Next, enable metrics monitoring for Red Hat Developer Hub.

  1. Open your values.yaml file.

  2. Select Edit > Edit single file. Login as a Platform Engineer with pe1/{common_password} when prompted.

  3. Find the YAML surrounded by --- MONITORING --- and uncomment this section by highlighting the lines, and pressing CMD + / or CTRL + /.

    uncomment monitoring

  4. Scroll down and enter a commit message feat: Enable monitoring.

  5. Click the Commit changes button.

Refresh the backstage Argo CD application

To apply the changes

  1. Navigate to view the backstage Argo CD Application in OpenShift GitOps. Login as admin/{openshift_gitops_password} if prompted.

  2. Click the Refresh button for the backstage Argo CD application.

  3. Wait until the Application status is Healthy.

  4. A new servicemonitor for Red Hat Developer Hub should now be created. You can verify this by viewing the backstage Argo CD application.

    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 step count
  4. You can leverage the metrics to build custom Grafana dashboards to visualise them as well.

Audit logging and Telemetry

You can monitor 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 topics are beyond the scope of this workshop, but you can explore them further in the Observability section of Red Hat Developer Hub product documentation.