이 페이지에서는 Service Infrastructure를 사용하여 관리형 서비스가 서비스 제작자 및 서비스 소비자 프로젝트에 보낼 모니터링 데이터를 생성하도록 하는 방법을 설명합니다. Monitoring은 개별 관리형 서비스의 성능, 가동시간, 전반적인 상태에 관한 정보를 제공합니다.
Service Control API는 측정항목을 수락하여 일괄 처리하고 Cloud Monitoring으로 전달합니다.
Monitoring은 이러한 측정항목을 내부 데이터화하고 대시보드, 차트, 알림을 통해 유용한 정보를 제공합니다.
Monitoring만으로도 관리형 서비스는 관리형 서비스의 개발자가 사용할 모니터링 데이터를 생성할 수 있지만, Service Control API에서는 사용자까지도 사용할 수 있는 모니터링 데이터를 생성할 수 있습니다. 그러면 사용자들이 자신이 관리형 서비스를 어떻게 사용하고 있는지를 이해하고 진단할 수 있습니다.
이 가이드는 관리형 서비스에서 정의한 측정항목을 모니터링하기 위한 것입니다.
Service Control API를 통해 Monitoring 커스텀 측정항목을 보고할 수 없습니다. 커스텀 측정항목을 보고하려면 Monitoring 가이드를 따라야 합니다.
모니터링 구성
Service Control API에 모니터링 데이터를 보내기 전에 서비스 구성에서 세 가지 정보를 지정해야 합니다.
모니터링 리소스: 모니터링 리소스는 일부 모니터링 데이터를 생성하는 클라우드 항목을 나타냅니다. 서비스 구성에서 모니터링 리소스를 정의하려면 기술 사양에서 monitored_resource.proto를 참조하세요.
모니터링과 로깅 모두에 동일한 모니터링 리소스를 사용하는 것이 좋습니다.
측정항목: 하나 이상의 측정항목을 보고할 수 있습니다. 각 측정항목은 일정 기간 동안 추적되는 상태 값입니다. 측정항목을 정의하는 기술 사양은 metric.proto를 참조하세요.
모니터링 구성: 개별 모니터링 리소스와 연관된 측정항목 그리고 각 측정항목을 받아야 하는 서비스 프로듀서 또는 서비스 소비자 프로젝트를 지정할 수 있습니다. 자세한 내용은 monitoring.proto를 참조하세요.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["이해하기 어려움","hardToUnderstand","thumb-down"],["잘못된 정보 또는 샘플 코드","incorrectInformationOrSampleCode","thumb-down"],["필요한 정보/샘플이 없음","missingTheInformationSamplesINeed","thumb-down"],["번역 문제","translationIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["# Reporting Monitoring Metrics\n\nThis page describes how to use Service Infrastructure to enable\n[managed services](/service-infrastructure/docs/glossary#managed) to generate monitoring\ndata to send to [service producer](/service-infrastructure/docs/glossary#producer)\nand [service consumer](/service-infrastructure/docs/glossary#consumer) projects. Monitoring provides\nvisibility into the performance, uptime, and overall health of individual\nmanaged services.\n\nThe Service Control API accepts metrics, which it batches\nand forwards to [Cloud Monitoring](/monitoring).\nMonitoring ingests these metrics and generates insights via\ndashboards, charts, and alerts.\n\nWhereas Monitoring alone allows a managed service to generate\nmonitoring data for use by you as a developer of the managed service,\nthe Service Control API also lets you generate monitoring data which is\nintended for your users. This makes it possible for your users to understand and\ndiagnose use of your managed service.\n\nNote, this guide is for\nmonitoring metrics defined by [managed services](/service-infrastructure/docs/glossary#managed).\nMonitoring Custom Metrics cannot be reported via\nService Control API. To report Custom Metrics, you need to follow\nthe Monitoring [guide](/monitoring/custom-metrics).\n\nConfiguring monitoring\n----------------------\n\nBefore you send monitoring data to the Service Control API, you need to\nspecify three different bits of information in your\n[service configuration](/service-infrastructure/docs/service-management/reference/rpc/google.api#google.api.Service):\n\n- **Monitored resources** : A\n [monitored resource](/monitoring/api/v3/metrics#intro-resources)\n represents a cloud entity that produces some monitoring data. To define a\n monitored resource in the service configuration, see\n [monitored_resource.proto](https://github.com/googleapis/googleapis/blob/master/google/api/monitored_resource.proto)\n for the technical specification.\n We strongly recommend you to use the same monitored resource for both\n monitoring and [logging](/service-infrastructure/docs/report-logs).\n\n- **Metrics** : You can report one or more metrics. Each metric represents\n a single piece of state whose value is tracked over time. See\n [metric.proto](https://github.com/googleapis/googleapis/blob/master/google/api/metric.proto)\n for the technical specification to define a metric.\n\n- **Monitoring configuration** : Lets you specify the metrics associated with\n individual monitored resources and the service producer or service consumer\n project where each metric should be sent. See\n [monitoring.proto](https://github.com/googleapis/googleapis/blob/master/google/api/monitoring.proto)\n for details.\n\nThe following example of service configuration defines a monitored\nresource and a metric. \n\n # The definition of the monitored resource to be used.\n monitored_resources:\n - type: library.appspot.com/Branch\n description: A library branch.\n display_name: Library Branch\n launch_stage: ALPHA\n labels:\n - key: resource_container\n description: The Google Cloud resource container (ie. project id) for\n the branch.\n - key: location\n description: The Google Cloud region the branch is located.\n - key: branch_id\n description: The ID of the branch.\n\n # The definition of the metrics to be used.\n metrics:\n - name: library.appspot.com/book/num_overdue\n display_name: Books Overdue\n description: The current number of overdue books.\n launch_stage: ALPHA\n metric_kind: GAUGE\n value_type: INT64\n unit: 1\n - name: library.googleapis.com/book/returned_count\n display_name: Books Returned\n description: The count of books that have been returned.\n launch_stage: ALPHA\n metric_kind: DELTA\n value_type: INT64\n unit: 1\n\n # The monitoring configuration.\n monitoring:\n producer_destinations:\n - monitored_resource: library.appspot.com/Branch\n metrics:\n - library.googleapis.com/book/returned_count\n consumer_destinations:\n - monitored_resource: library.appspot.com/Branch\n metrics:\n - library.appspot.com/book/num_overdue\n\nAfter you have authored such configuration, you will need to follow\n[Managing Service Configurations](/service-infrastructure/docs/manage-config)\nand\n[Managing Service Rollouts](/service-infrastructure/docs/rollout) to push\nthe service configuration to Service Management API, which will configure the\nmonitored resource and metric definitions in [Cloud Monitoring](/monitoring).\n\nReporting metrics\n-----------------\n\nAfter the service configuration push finishes, you can call the\nService Control API to report metrics. The following example uses the\n`gcurl` command to demonstrate the call. For information on how to set this up,\nsee\n[Getting Started with the Service Control API](/service-infrastructure/docs/service-control/getting-started). \n\n```\ngcurl -d \"{\n 'operations': [ {\n 'operationId': '8356d3c5-f9b5-4274-b4f9-079a3731e6e5',\n 'operationName': 'Return books',\n 'consumerId': 'projects/library-consumer',\n 'startTime': '`date +%FT%T%:z`',\n 'endTime': '`date +%FT%T%:z --date=\"5 seconds\"`',\n 'labels': {\n 'location': 'us-east1',\n 'branch_id': 'my-test-library-branch'\n },\n 'metricValueSets': [ {\n 'metricName': 'library.googleapis.com/book/returned_count',\n 'metricValues': [ { 'int64Value': '23' } ]\n } ]\n } ]\n}\" https://servicecontrol.googleapis.com/v1/services/endpointsapis.appspot.com:report\n```"]]