Creating custom dashboards to monitor Code Engine
Use IBM Cloud Monitoring to gain visibility into the health and performance of Code Engine workloads. You can customize a Monitoring dashboard for Code Engine workloads to a tailored set of metrics to help you identify bottlenecks or predict possible production problems.
Create custom dashboards to monitor Code Engine
You can create a custom Monitoring dashboard for Code Engine workloads to a tailored set of metrics.
Before you can create a custom dashboard in Monitoring, you must first set up monitoring for Code Engine workloads. Set up your Monitoring service instance and enable Platform Metrics in the same region as the Code Engine projects that you want to monitor. If you have deployments in more than one region, you must provision Monitoring and enable platform metrics for each region. For more information about setting up your IBM Cloud Monitoring service instance and accessing your IBM Cloud Monitoring metrics dashboard for monitoring Code Engine workloads, see Monitoring for Code Engine.
Code Engine provides the IBM Code Engine Project Overview
dashboard, which is composed of pre-defined panels that monitor various aspects of Code Engine workloads. You might want to create a custom Monitoring dashboard for Code
Engine workloads to a tailored set of metrics.
-
Set up an IBM Cloud Monitoring service instance. To check for active IBM Cloud Monitoring instances, see the Observability dashboard.
-
Ensure that there is monitoring data available. Because designing a custom dashboard is easier when you have data to monitor, it is important to have a running application or job. Some Code Engine metrics exist only if they are available in the environment.
-
Review the available metrics for Code Engine.
-
Access your IBM Cloud Monitoring metrics.
- From the IBM Cloud navigation menu, select Observability.
- Select Monitoring.
- Click Open dashboard to open the dashboard for your monitoring instance.
- From the navigation menu, select Dashboards->IBM->IBM Code Engine Project Overview. If you don't see the Code Engine dashboard in the menu, you can start monitoring from your Code Engine application or job by selecting Launch Monitoring.
-
Click Create Custom Dashboard to make a copy of the
IBM Code Engine Project Overview
dashboard. Enter a name for your custom dashboard and click Create and open. For example, name your dashboardMy custom IBM Code Engine Project Overview
. -
Customize your dashboard by adding or removing dashboard panels. For examples of how you might want to customize your dashboard for monitoring Code Engine application and job run workloads, see Scenario 1 and Scenario 2. For more information about working with IBM Cloud Monitoring dashboards, see Working with dashboards.
Whenever you change the layout of your dashboard, be sure to click Save Layout to save your changes. You must save the layout changes or cancel before you continue to customize to your dashboard.
-
Save the custom dashboard. The custom dashboard is available in the dashboard navigation menu, Dashboards->My Dashboards.
Scenario 1: Focusing on Code Engine application instances and job runs
Suppose you want to narrow the scope of monitoring Code Engine workloads to focus on instances of your running applications and job runs. It can be useful to monitor this information because if your application scales to zero or your job or
build isn't running, then you're not consuming resources. This scenario takes the My custom IBM Code Engine Project Overview
dashboard that you previously created from the existing IBM Code Engine Project Overview
dashboard and simplifies the custom dashboard by modifying and removing panels.
-
Open your custom dashboard. This scenario assumes that you are starting with a copy of the
IBM Code Engine Project Overview
dashboard. The custom dashboard is available in the dashboard navigation menu, Dashboards->My Dashboards. -
Modify the
Total number of Applications
number panel and modify the query to display the actual number of instances by using theibm_codeengine_application_actual_instances
metric.- Click the pencil icon to edit the panel.
- From the Query tab, click the
ibm_codeengine_application_service_count
metric to modify the metric. Typeibm_codeengine_
for a list of Code Engine metrics. For this example, select theibm_codeengine_application_actual_instances
metric and specify aMaximum
time aggregation and aMaximum
group rollup. - From the Panel tab, rename this panel to
Total number of Application Instances
. - Click Save to save the changes for this panel.
-
Modify the
Total number of Application revisions
number panel and change the query to display the number of job runs by using theibm_codeengine_jobruns
metric.- Click the pencil icon to edit the panel.
- From the Query tab, click the
ibm_codeengine_application_revision_count
metric to modify the metric. Typeibm_codeengine_
for a list of Code Engine metrics. For this example, select theibm_codeengine_jobruns
metric and specify aMaximum
time aggregation and aMaximum
group rollup. - From the Panel tab, rename this panel to
Total number of Job Runs
. - Click Save to save the changes for this panel.
-
Delete the
Total number of Application routes
number panel by using the action menu. -
Modify the
Applications overview
timechart panel and change the query to display monitoring information about your application and job run instances by using theibm_codeengine_application_actual_instances
andibm_codeengine_jobruns
metrics.- Click the pencil icon to edit the panel.
- From the Query tab, keep the
ibm_codeengine_application_actual_instances
metric and remove the other rows of metrics by using the action menu for those metrics. - From the Query tab, locate the
ibm_codeengine_application_actual_instances
metric and modify the segmentation to include application revision information. Clickibm_codeengine_application_name
and addibm_codeengine_revision_name
. Make sure that you clear the selection forApply to All Queries
. - From the Query tab, click Add Query to add a query for job runs. In the metric field, type
ibm_codeengine_
for a list of Code Engine metrics. Select theibm_codeengine_jobruns
metric and specify aMaximum
time aggregation and aMaximum
group rollup. Specify theibm_codeengine_jobrun_condition
segmentation for this metric. - Check that you only set the
ibm_codeengine_application_actual_instances
andibm_codeengine_jobruns
metrics for this panel. - From the Panel tab, change the name of this panel to
Application and Job Run Instances
. - Click Save to save the changes for this panel
-
Keep the panels that were updated in the previous steps for this scenario, but use the actions menu to delete other panels. After you remove panels that are not needed, you can adjust the size and layout of the individual panels to meet your needs.
Whenever you change the layout of your dashboard, be sure to click Save Layout to save your changes. You must save the layout changes or cancel before you continue to make changes to your dashboard.
After you complete scenario 1, your custom dashboard includes three panels: Total number of Application Instances
, Total number of Job Runs
, and Application and Job Run Instances
.
Scenario 2: Using PromQL queries with Code Engine workloads
From the custom dashboard that you created in Scenario 1, suppose you want to use the Prometheus Query Language (PromQL) query feature of IBM Cloud Monitoring to aggregate the number of applications and job runs metrics into one panel. In this scenario, let's use PromQL to add the number of application instances and the number of job runs into a single number panel.
-
Open your custom dashboard that was customized with Scenario 1. The custom dashboard is available in the dashboard navigation menu, Dashboards->My Dashboards.
-
Modify the
Total number of Applications
number panel and change the query to sum the number of application instances and the number of job runs.- Click the pencil icon to edit the panel.
- From the Query tab, click
PromQL
to use PromQL queries. - From the Query tab, replace the contents of the query with
sum(max(ibm_codeengine_application_actual_instances) + max(ibm_codeengine_jobruns))
. Update Options to usenumber
as the unit. Click Run query. - From the Panel tab, rename this panel to
Total number of Application instances and Job Runs
. - Click Save to save the changes for this panel.
-
Use the actions menu to delete the
Total number of Job Runs
number panel because we aggregated both the total number of applications and job runs into a single number panel in the previous step. -
You can adjust the size and layout of the individual panels to meet your needs.
Whenever you change the layout of your dashboard, be sure to click Save Layout to save your changes. You must save the layout changes or cancel before you continue to customize to your dashboard.
After you complete scenario 2, your custom dashboard includes two panels: Total number of Application instances and Job Runs
and Application and Job Run Instances
.