View Custom Metrics  | Cloud Monitoring  | Google Cloud (2023)

A custom metric is any metric thatit is notdefined by Google Cloud. They include metrics you can define and include metrics defined by a third-party application. Custom metrics allow you to capture application-specific data or client-side system databuilt-in measurescollected by Cloud Monitoring can give you information about background latency or disk usage, but they can't tell you, for example, how many background routines your application has run. You can also create metrics based on the content of log entries. For information about these types of metrics, seeOverview of log-based metrics.

Custom metrics are sometimes called custom metrics or application-specific metrics. These metrics allow you or a third-party application to define and collect information that Cloud Monitoring's built-in metrics cannot. You capture such metrics using the API provided by the library to instrument your code, and then send the metrics to a backend application such as Cloud Monitoring.

You can create custom metrics directly using the Cloud Monitoring API. However, we recommend that you useOpenTelemetry. See the following documents for information on creating custom metrics:

  • Purchase OTLP metrics and tracesdescribes how to use the Ops Agent and the agent's OpenTelemetry Protocol (OTLP) receiver to collect metrics and traces from applications instrumented with OpenTelemetry and running on Compute Engine.

  • Google Cloud Managed Service do Prometheusadescribes how to collect Prometheusmetrics from applications running on Google Kubernetes Engine and Kubernetes.

  • Saml Prometheus-metricdescribes how to use the Ops agent to collect Prometheus metrics from applications running on Compute Engine.

  • Create custom metrics using the APIdescribes how to create metrics using the Cloud Monitoring API and how to add metric data to those metrics. This document illustrates how to use the Monitoring API with usage examplesAPI Explorer, C#, Go, Java, Node.js, PHP, Python and Ruby programming languages.

  • Create custom metrics on Cloud Runshows how to use the OpenTelemetry Collector as a back-up agent in Cloud Run deployments.

    (Video) Logging & Monitoring - Creating and Monitoring Custom Metrics

For cloud monitoring, you can use custom metrics like built-in metrics. You can map them, set alerts about them, read them, and otherwise monitor them. For information on reading metrics, see the following documents:

  • Specify metrics and resource typesexplains how to display and examine your custom and built-in metric types. For example, you can use the information in this document to list all custom metric descriptors in your project.
  • Get time series dataexplainshow for retrieving time series data from metrics using the tracking API. For example, this document describes how you can use the API to get CPU utilization for VM instances in your Google Cloud project.

The Google Cloud Console has a dedicated page that helps you see your usage with custom metrics. For information about the content of this page, seeSe metrics-diagnostik.

Metric descriptors for custom metrics

Each metric type must have a metric descriptor that defines how the metric data is organized. The metric descriptor also defines the tags for the metric and the metric name. for examplemetric sheetshow metric descriptors for all built-in metric types.

Cloud Monitoring can create a metric descriptor for you using the metrics you write, or you can explicitly create a metric descriptor and then write the metrics. In either case, you need to decide how you want to organize your metrics.

Design example

Suppose you have a program running on one machine and that program calls utility programsUiB. You want to count how often programsUiBcalled. You also want to know when the program isUit is called more than 10 times a minute and the program comes upBit is called more than 5 times per minute. Finally, suppose you have a Google Cloud project and plan to write data to itgloballymonitored resource.

This example describes several different designs you can use for your custom metrics:

  • Use two metrics:Metric-tip-Aprogramming call countUiMetric Type-Bprogramming call countB. In this case,Metric-tip-Acontains 1 time series, iMetric Type-Bcontains 1 time series.

    You can create one alert rule with two conditions, or you can create two alert rules each with one condition with this data mode. An alert policy can support multiple conditions, but has a single configuration for notification channels.

    (Video) Custom metrics with OpenTelemetry

    This model may be appropriate when you are not interested in data similarities between tracked activities. In this example, activities are the number of program callsUiB.

  • You use a single metric and tag to store the app ID. For example, a tag can store a valueUorB.Monitoring creates a time series for each unique combination of tags. So there is a time series whose value is labelUand the second time series whose value is the labelB.

    As with the previous model, you can create one alert rule or two alert rules. However, the requirements for a whistleblowing policy are more complex. A condition that generates an event when the frequency of calls to the programUexceeds the threshold must use a filter that includes only data points whose value is labelU.

    The advantage of this model is that it is easy to calculate the ratios. For example, you can determine how much of the total is spent on callsU.

  • Use a single metric to count the number of calls, but do not use a tag to record which program was called. In this model, there is one time series that combines the data for the two programs. However, you cannot create an alert rule that meets your goals because the data for the two programs cannot be separated.

The first two designs allow you to meet your data analysis requirements; however, the final design does not.

For more information seeCreate custom metrics.

Names of custom metrics

When you create a custom metric, you define a string ID that represents the metric type. This string must be unique among user-defined metrics in your Google Cloud project and must use a prefix that designates the metric as a user-defined metric. Prefixes are allowed for,, The prefix is ​​followed by a name that describes what you are collecting. For details on the recommended way to name metrics, seeMetric Naming Rules.These are examples of two types of identifiers for metric types:

(Video) Best practices for custom metric telemetry on Google Cloud

In the previous example, the prefixcustom.googleapis.comindicates that both metrics are custom metrics. Both examples refer to metrics that measure CPU utilization; however, they use different organizational models. When you expect to have a large number of custom metrics, we recommend using a hierarchical naming structure like the one used in the second example.

All metric types have globally unique identifiers calledresource names. The resource name structure for a metric type is:


whereMETRIC_TYPEis a string identifier of metric type. If previous metric examples were created in the projects ID-project, then their resource names for these metrics would be:

projects/my-project-id/metricDescriptors/ projects/my-project-id/metricDescriptors/

Name or species?It is in the metric descriptorTo dofield stores the resource name of topic type itipthe field savesMETRIC_TYPEcable.

Monitored resource types for custom metrics

When entering your data into a time series, you need to specify where the data comes from. To specify a data source, select a monitored source type that represents where your data comes from, and then use it to describe a specific origin. The monitored resource is not part of a metric type. Instead it isweather seriesto which you write data includes a metric type reference and a monitored resource reference. The metric type describes the data, while the monitored resource describes where the data comes from.

Consider the monitored resource before creating your metric descriptor. The type of monitored resource you are using affects which tags you include in the metric descriptor. for exampleResurs Compute Engine VMcontains labels for the project ID, instance ID, and instance zone. Therefore, if you plan to write your metrics against a Compute Engine VM resource, then the resource tags include the instance ID, so you don't need the instance ID tag in the metrics descriptor.

Each data point of your metric must be associated with a monitored resource object. Points from different monitored resource objects are stored in different onesweather series.

You must use one of the following monitored resource types with custom metrics:

(Video) Custom metrics with OpenCensus

  • aws_ec2_instance: Amazon EC2 instanca.
  • data_flow_job: Dataflow job.
  • home_station: App Engine instanca.
  • gce_instance: Compute Engine instanca.
  • generic_node: user-specified computing node.
  • generic_task: Custom task.
  • gke_container: GKE container instance.
  • globally: Use this resource when no other type of resource is suitable. For most use cases,generic_nodeorgeneric_taskis a better choice thanglobally.
  • k8s_clusters: Kubernetes cluster.
  • k8s_container: Kubernetes container.
  • k8s_node: Kubernetes node.
  • k8s_pod: Kubernetes pod.

Common practice is to use monitored resource objects that represent the physical resources on which your application code runs. This approach has several advantages:

  • You get better performance compared to using one type of resource.
  • You avoid out-of-order data caused by multiple processes writing the same time series.
  • You can group your custom metrics with other metrics from the same sources.

globallyand generic resources

Thegeneric_taskigeneric_noderesource types are useful in situations where none of the more specific resource types are suitablegeneric_tasktype is useful for defining task-like resources such as applications. Yesgeneric_nodetype is useful for defining node-like resources such as virtual machines. Bothgeneric_*types have several common tags that you can use to define unique resource objects, making them easy to use in aggregation and reduction metric filters.

In contrastgloballytype of resource has onlyproject_idiPlacelabels. When you have many metrics sources in a project, use the same onesgloballyresource object can cause collisions and delete your metrics.

API methods that support custom metrics

The following table shows which methods in the Tracking API support custom metrics and which methods support built-in metrics:

Control API methodUse with
custom metrics
Use with
built-in measures
time series.listII
time sequence. createI

Limitations and delays

For restrictions on custom metrics and data retention, seeQuotas and limits.

To retain your metrics after the retention period, you must manually copy the data to another location, such as Cloud Storage or BigQuery.

For information about the delays associated with writing data to custom metrics, seeMetric data latency.

What's next

  • UseGoogle Cloud Managed Service do Prometheusato collect Prometheusmetrics from applications running on Google Kubernetes Engine and Kubernetes.
  • Saml Prometheus-metricfrom applications running on Compute Engine.
  • Purchase OTLP metrics and tracesfrom applications instrumented with OpenTelemetry and running on Compute Engine.
  • Create custom metrics using the API
  • Uvod u Cloud Monitoring API
  • Metrics, Time Series and Resources


What are the limits for GCP Cloud Monitoring? ›

Limits for alerting and uptime checks
Maximum forecast window7 days (604,800 seconds)
Notification channels per alerting policy16
Maximum rate of notifications1 notification every 5 minutes for each log-based alert
Maximum number of notifications20 notifications a day for each log-based alert
17 more rows

Is it true or false to monitor cloud run job performance and metrics you need to set up and configure Cloud Monitoring? ›

Cloud Run is automatically integrated with Cloud Monitoring with no setup or configuration required. This means that metrics of your Cloud Run services and jobs are captured automatically when they are running. You can view metrics either in Cloud Monitoring or in the Cloud Run service and jobs pages in the console.

Which two types of data can you view in the monitoring API? ›

You can view API metrics in two places: API Dashboard and Cloud Monitoring. The metrics you see are specific to your project, and they don't reflect the overall service status.

How do you create metrics in GCP? ›

Manual creation of metric descriptors
  1. Choose a metric name for your user-defined metric.
  2. Choose a display name and description for your metric. ...
  3. Choose a project or projects in which to define your user-defined metric and write its time series data. ...
  4. Determine the metric's kind, value type, and (optionally) units.

What are the best practices for GCP monitoring? ›

Best practice rules for GCP Cloud Logging

Ensure that custom IAM role changes are being monitored using alerting policies. Ensure that VPC network firewall rule changes are being monitored using alerting policies. Ensure that SQL instance configuration changes are being monitored using alerting policies.

What is the limit of metadata in GCP? ›

Each metadata value has a maximum limit of 256 KB. Each metadata value is case sensitive except for boolean values.

What do you need to consider when monitoring performance? ›

7 Ways to Monitor Your Staff Performance and Increase Motivation
  • Use a Monitoring Software.
  • Check-in Regularly.
  • Set Targets.
  • Implement Self-Monitoring Tools.
  • Ask Around a Little.
  • Analyse and Reward.
  • Involve Them.
Mar 23, 2020

What are some of the benefits that cloud monitoring solutions offer? ›

Cloud monitoring allows you to find out if your cloud-hosted applications are performing within their Service-Level Agreement (SLA), discover any potential security risks, identify any capacity issues, and analyze costs.

How does the monitoring agent monitor the cloud usage? ›

The Monitoring agent is a collectd-based daemon that gathers system and application metrics from virtual machine instances and sends them to Monitoring. By default, the Monitoring agent collects disk, CPU, network, and process metrics.

What are the two 2 types of monitoring used in process control? ›

The process monitoring tools can broadly be divided into two categories: model-based and data-based.

What are the four golden signals? ›

Golden Signals are a reduced set of metrics that offer a wide view of a service from a user or consumer perspective: Latency, Traffic, Errors and Saturation.

Which metrics should you track for your API? ›

Top API Metrics for Different Teams That You Should Monitor
  • CPU Usage.
  • Memory Usage.
  • Uptime.
  • Average and Max Latency.
  • Errors Per Minute.
  • Request Per Minute (RPM)
  • API Calls Per Business Transaction.
  • API Retention.
Aug 16, 2022

How do I see custom metrics in Google Analytics? ›

Sign in to Google Analytics. Click Admin, and navigate to the property to which you want to add custom metrics. In the PROPERTY column, click Custom Definitions > Custom Metrics. Click the New Custom Metric button.

How do I set custom metrics in CloudWatch? ›

Push custom metrics using the CloudWatch agent
  1. Install the CloudWatch unified agent.
  2. Assign a role or credentials to the instance with CloudWatch permissions.
  3. Create the CloudWatch agent configuration file.
  4. Start the agent.

What scope applies to custom metrics? ›

A custom metric always has an event scope.

What are the four monitoring strategies? ›

1.4 The monitoring and evaluation strategy is organized into four main streams of work: results monitoring, grant monitoring, evaluation, and dissemination and learning.

What is the monitoring tool in GCP? ›

Cloud Monitoring offers automatic out-of-the-box metric collection dashboards for Google Cloud services. It also supports monitoring of hybrid and multicloud environments.

What is the difference between logging and monitoring in GCP? ›

Cloud Logging automatically ingests Google Cloud audit and platform logs so that you can get started right away. Cloud Monitoring provides a view of all Google Cloud metrics at zero cost and integrates with a variety of providers for non Google Cloud monitoring.

How many records we can store in custom metadata? ›

You can reference up to 15 unique custom metadata types in all validation rules per entity. For example, from all validation rule formulas combined for a specified object, you can reference up to 15 different custom metadata types.

What is the maximum RAM on GCP? ›

The maximum amount of memory you can configure is 32 gibibyte ( 32 Gi ).

What is the maximum number of projects in GCP? ›

By default, Google Cloud only allows the creation of five projects per billing account.

What are the four elements of monitoring? ›

A monitoring system has four main components: observation, analysis, action, and storage.

What are the three methods of monitoring performance? ›

Graphic rating scales, management by objectives and forced ranking are three methods used to measure employee performance.

What are the two best practices for monitoring performance? ›

Application Performance Monitoring Best Practices
  • Choose the right tool for your application. Is your application available across technologies? ...
  • Maintenance. Make sure the automated processes you build using an APM tool are easy to maintain. ...
  • Set up alerts. ...
  • Create internal processes. ...
  • Test and verify. ...
  • Reporting. ...
  • Ask for help.

What is an example of cloud monitoring? ›

Types of cloud monitoring

For security purposes, access requests can be tracked as well. For example, an uptime detector can alert if there's database instability and can help improve resolution response time from the precise moment that a database goes down.

What are cloud metrics? ›

Cloud metrics provides insights into your cloud computing. It allows predictive analysis of your system, to determine when your servers are under load and requires provisioning. By using the cloud metrics data you can set up thresholds via policies that react to certain conditions during the cloud operations.

What do monitoring tasks for the cloud include? ›

Cloud monitoring primarily includes functions such as: Website monitoring: Tracking the processes, traffic, availability and resource utilization of cloud-hosted websites. Virtual machine monitoring: Monitoring the virtualization infrastructure and individual virtual machines.

What are the benefits of cloud monitoring? ›

Benefits of cloud monitoring
  • Improving the security of cloud applications and networks.
  • Simplifying the implementation of continuity plans, enabling proactive (rather than reactive) risk remediation.
  • Achieving and maintaining ideal application performance.
May 23, 2022

What two ways can a cloud server be monitored? ›

Cloud Monitoring Strategy

Availability data, such as data provided by AWS and Azure status RSS feeds. Data is measured by the LogicMonitor Collector, and scheduled maintenance events.

Which of the following are the key components that need to be monitored in a cloud infrastructure? ›

Key Components of Cloud Infrastructure Security
  • Cloud Provider and Customer Security Responsibilities. ...
  • Vulnerability Scanning and Compliance. ...
  • Network and Firewall Security. ...
  • Edge Network protection. ...
  • Web Application Firewalls (OWASP, Custom Rules, Geo Filters) ...
  • OS Vulnerability protection.

What are the 6 steps in the monitoring procedure? ›

  • Step 1: Identify Program Goals and Objectives. ...
  • Step 2: Define Indicators. ...
  • Step 3: Define Data Collection Methods and TImeline. ...
  • Step 4: Identify M&E Roles and Responsibilities. ...
  • Step 5: Create an Analysis Plan and Reporting Templates. ...
  • Step 6: Plan for Dissemination and Donor Reporting.

What are the three main types of monitoring? ›

The term monitoring approaches refers to the three main categories of monitoring in the Program Cycle, as specified in ADS 201.3. 5.5. These approaches are performance monitoring, context monitoring, and complementary monitoring.

What are the three types of monitoring? ›

3. What are the four forms of monitoring?
  • Compliance monitoring.
  • Financial monitoring.
  • Process monitoring.
  • Beneficiary monitoring.
Mar 14, 2023

What is alerting in Google cloud? ›

Alerting gives timely awareness to problems in your cloud applications so you can resolve the problems quickly. In Cloud Monitoring, an alerting policy describes the circumstances under which you want to be alerted and how you want to be notified.

What is the difference between observability and monitoring? ›

The difference between observability vs. monitoring focuses on whether data pulled from an IT system is predetermined or not. Monitoring is a solution that collects and analyzes predetermined data pulled from individual systems. Observability is a solution that aggregates all data produced by all IT systems.

What is the difference between white box monitoring and black box monitoring? ›

Whitebox monitoring deals with monitoring the number of HTTP requests to a server, MySQL queries running on a database server, and so on. On the other hand, Blackbox monitoring refers to the monitoring of servers and server resources such as CPU usage, memory, load averages, and so on.

Which metrics are the most important to track? ›

The following are important metrics businesses use to track performance in each area.
  • Business performance metrics.
  • Sales performance metrics.
  • Project management performance metrics.
  • Employee performance metrics.
Mar 10, 2023

How often should you track metrics? ›

Metrics You Should Be Tracking Bi-Weekly

Funnel or lead reporting can be tracked bi-weekly because they generally take more time to generate traction. Checking weekly may give you a false impression that things aren't working as they should, and may hinder you from making changes if need be.

How do you measure success of an API? ›

The most basic set of API metrics is operational. They measure API performance, such as the number of APIs, the number of API calls, CPU or memory usage. Operational metrics give an indication of the operational stability of an API platform.

How do I view custom metrics in CloudWatch? ›

Select any metric on the Metric page of the CloudWatch console. Then, choose the Source tab to view a JSON object containing the metric array that defines the namespace, name, and dimensions of the selected metric.

How do I check my CloudWatch custom metrics? ›

Check the custom metric in CloudWatch.

Under All metrics, there is a new section for Custom metrics. Click on Custom, and the new custom metric is now available.

How do I see custom UTM parameters in Google Analytics? ›

To find your UTM data in Google Analytics, navigate to » Acquisition » Campaigns » All Campaigns.
  1. Please note the different Primary Dimensions you can select to really dig into this data:
  2. The Primary Dimensions include Campaign, Source, Medium, and Source / Medium.
Sep 25, 2021

Which of the following requires a custom CloudWatch metric to monitor? ›

The correct answer is option A (Memory Utilization of an EC2 instance). CloudWatch is a monitoring tool that allows us to monitor our infrastructure and get alerted if anything goes wrong.

How do I fetch CloudWatch metrics? ›

  1. Create an input parameter for your GetMetricData API call (metric-data-queries. json). ...
  2. Publish sample metric data as custom metrics using PutMetricData. ...
  3. Run the command aws cloudwatch get-metric-data with your input parameters.
  4. Review the output.

How long are CloudWatch metrics kept? ›

Amazon CloudWatch stores metrics for terminated Amazon EC2 instances or deleted Elastic Load Balancers for 15 months.

What is the difference between calculated metrics and custom metrics? ›

#2 Custom metric is used to collect the data which Google Analytics does not automatically collect (like phone call data, CRM data etc). Whereas a ''Calculated metric' is used to collect/compute new data, from the already available data in GA.

What is the difference between custom and external metrics? ›

About custom, Prometheus, and external metrics

Metrics coming from Managed Service for Prometheus are considered a type of custom metric. An external metric is reported from an application or service not running on your cluster, but whose performance impacts your Kubernetes application.

What are the 4 types of scope in Google Analytics? ›

There are four levels of scope: product, hit, session, and user: Product – value is applied to the product for which it has been set (Enhanced Ecommerce only).

What is the limit of GCP cloud tasks? ›

Stay organized with collections Save and categorize content based on your preferences. The Google Tasks API has a courtesy limit of 50,000 queries per day. If you need capacity beyond this courtesy limit, you can send a request from the Quotas pane of the Google APIs Console.

What are the limits on Google Cloud Functions? ›

500MB (uncompressed) for sources plus modules. 10MB for streaming responses. 32MB for non-streaming responses.

What is the maximum instances limit in cloud run? ›

By default, Cloud Run services are configured to scale out to a maximum of 100 instances. You can change the maximum instances setting using the Google Cloud console, the gcloud command line, or a YAML file when you create a new service or deploy a new revision.

What is the limit of Google Cloud database? ›

Cloud SQL storage limits

Dedicated core: Up to 64 TB. Shared core: Up to 3 TB.

What is the limit of GCP in API gateway? ›

A rate limit of 10,000,000 quota units per 100 seconds per service producer project is enforced by default. One quota unit is consumed for each call to services. check and for each operation reported by .

What is the maximum timeout in GCP? ›

The timeout is set by default to 5 minutes and can be extended up to 60 minutes.

What is the API rate limit for cloud run? ›

Cloud Run Admin API rate Limits

The number of API reads per 60 seconds per project. This is not the number of read requests to your Cloud Run services, which is not limited. The number of API writes per 60 seconds per project.


1. How to Create Cloud watch Custom metrics and alarms In Real time use cases?
2. Cloud Monitoring in a minute
(Google Cloud Tech)
3. Cloud Monitoring: Create custom notification channels
(Google Cloud Tech)
4. What are dashboards in GCP ? #GCP #monitoring
5. Designing for observability on Google Cloud
(Google Cloud Tech)
6. Autoscaling an Instance Group with Custom Cloud Monitoring Metrics || #GCRF || #qwiklabs || #GSP087
(Quick Lab)


Top Articles
Latest Posts
Article information

Author: Dan Stracke

Last Updated: 01/08/2023

Views: 6023

Rating: 4.2 / 5 (63 voted)

Reviews: 94% of readers found this page helpful

Author information

Name: Dan Stracke

Birthday: 1992-08-25

Address: 2253 Brown Springs, East Alla, OH 38634-0309

Phone: +398735162064

Job: Investor Government Associate

Hobby: Shopping, LARPing, Scrapbooking, Surfing, Slacklining, Dance, Glassblowing

Introduction: My name is Dan Stracke, I am a homely, gleaming, glamorous, inquisitive, homely, gorgeous, light person who loves writing and wants to share my knowledge and understanding with you.