xref: /aosp_15_r20/external/googleapis/google/api/servicecontrol/README.md (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1*d5c09012SAndroid Build Coastguard WorkerGoogle Service Control provides control plane functionality to managed services,
2*d5c09012SAndroid Build Coastguard Workersuch as logging, monitoring, and status checks. This page provides an overview
3*d5c09012SAndroid Build Coastguard Workerof what it does and how it works.
4*d5c09012SAndroid Build Coastguard Worker
5*d5c09012SAndroid Build Coastguard Worker## Why use Service Control?
6*d5c09012SAndroid Build Coastguard Worker
7*d5c09012SAndroid Build Coastguard WorkerWhen you develop a cloud service, you typically start with the business
8*d5c09012SAndroid Build Coastguard Workerrequirements and the architecture design, then proceed with API definition
9*d5c09012SAndroid Build Coastguard Workerand implementation. Before you put your service into production, you
10*d5c09012SAndroid Build Coastguard Workerneed to deal with many control plane issues:
11*d5c09012SAndroid Build Coastguard Worker
12*d5c09012SAndroid Build Coastguard Worker* How to control access to your service.
13*d5c09012SAndroid Build Coastguard Worker* How to send logging and monitoring data to both consumers and producers.
14*d5c09012SAndroid Build Coastguard Worker* How to create and manage dashboards to visualize this data.
15*d5c09012SAndroid Build Coastguard Worker* How to automatically scale the control plane components with your service.
16*d5c09012SAndroid Build Coastguard Worker
17*d5c09012SAndroid Build Coastguard WorkerService Control is a mature and feature-rich control plane provider
18*d5c09012SAndroid Build Coastguard Workerthat addresses these needs with high efficiency, high scalability,
19*d5c09012SAndroid Build Coastguard Workerand high availability. It provides a simple public API that can be accessed
20*d5c09012SAndroid Build Coastguard Workerfrom anywhere using JSON REST and gRPC clients, so when you move your service
21*d5c09012SAndroid Build Coastguard Workerfrom on-premise to a cloud provider, or from one cloud provider to another,
22*d5c09012SAndroid Build Coastguard Workeryou don't need to change the control plane provider.
23*d5c09012SAndroid Build Coastguard Worker
24*d5c09012SAndroid Build Coastguard WorkerServices built using Google Cloud Endpoints already take advantage of
25*d5c09012SAndroid Build Coastguard WorkerService Control. Cloud Endpoints sends logging and monitoring data
26*d5c09012SAndroid Build Coastguard Workerthrough Google Service Control for every request arriving at its
27*d5c09012SAndroid Build Coastguard Workerproxy. If you need to report any additional logging and monitoring data for
28*d5c09012SAndroid Build Coastguard Workeryour Cloud Endpoints service, you can call the Service Control API directly
29*d5c09012SAndroid Build Coastguard Workerfrom your service.
30*d5c09012SAndroid Build Coastguard Worker
31*d5c09012SAndroid Build Coastguard WorkerThe Service Control API definition is open sourced and available on
32*d5c09012SAndroid Build Coastguard Worker[GitHub](https://github.com/googleapis/googleapis/tree/master/google/api/servicecontrol).
33*d5c09012SAndroid Build Coastguard WorkerBy changing the DNS name, you can easily use alternative implementations of
34*d5c09012SAndroid Build Coastguard Workerthe Service Control API.
35*d5c09012SAndroid Build Coastguard Worker
36*d5c09012SAndroid Build Coastguard Worker## Architecture
37*d5c09012SAndroid Build Coastguard Worker
38*d5c09012SAndroid Build Coastguard WorkerGoogle Service Control works with a set of *managed services* and their
39*d5c09012SAndroid Build Coastguard Worker*operations* (activities), *checks* whether an operation is allowed to proceed,
40*d5c09012SAndroid Build Coastguard Workerand *reports* completed operations. Behind the scenes, it leverages other
41*d5c09012SAndroid Build Coastguard WorkerGoogle Cloud services, such as
42*d5c09012SAndroid Build Coastguard Worker[Google Service Management](/service-management),
43*d5c09012SAndroid Build Coastguard Worker[Stackdriver Logging](/logging), and [Stackdriver Monitoring](/monitoring),
44*d5c09012SAndroid Build Coastguard Workerwhile hiding their complexity from service producers. It enables service
45*d5c09012SAndroid Build Coastguard Workerproducers to send telemetry data to their consumers. It uses caching,
46*d5c09012SAndroid Build Coastguard Workerbatching, aggregation, and retries to deliver higher performance and
47*d5c09012SAndroid Build Coastguard Workeravailability than the individual backend systems it encapsulates.
48*d5c09012SAndroid Build Coastguard Worker
49*d5c09012SAndroid Build Coastguard Worker<figure id="fig-arch" class="center">
50*d5c09012SAndroid Build Coastguard Worker<div style="width: 70%;margin: auto">
51*d5c09012SAndroid Build Coastguard Worker  <img src="/service-control/images/arch.svg"
52*d5c09012SAndroid Build Coastguard Worker    alt="The overall architecture of a service that uses Google Service Control.">
53*d5c09012SAndroid Build Coastguard Worker</div>
54*d5c09012SAndroid Build Coastguard Worker<figcaption><b>Figure 1</b>: Using Google Service Control.</figcaption>
55*d5c09012SAndroid Build Coastguard Worker</figure>
56*d5c09012SAndroid Build Coastguard Worker
57*d5c09012SAndroid Build Coastguard WorkerThe Service Control API provides two methods:
58*d5c09012SAndroid Build Coastguard Worker
59*d5c09012SAndroid Build Coastguard Worker* [`services.check`](/service-control/reference/rest/v1/services/check), used for:
60*d5c09012SAndroid Build Coastguard Worker    * Ensuring valid consumer status
61*d5c09012SAndroid Build Coastguard Worker    * Validating API keys
62*d5c09012SAndroid Build Coastguard Worker* [`services.report`](/service-control/reference/rest/v1/services/report), used for:
63*d5c09012SAndroid Build Coastguard Worker    * Sending logs to Stackdriver Logging
64*d5c09012SAndroid Build Coastguard Worker    * Sending metrics to Stackdriver Monitoring
65*d5c09012SAndroid Build Coastguard Worker
66*d5c09012SAndroid Build Coastguard WorkerWe’ll look at these in more detail in the rest of this overview.
67*d5c09012SAndroid Build Coastguard Worker
68*d5c09012SAndroid Build Coastguard Worker## Managed services
69*d5c09012SAndroid Build Coastguard Worker
70*d5c09012SAndroid Build Coastguard WorkerA [managed service](/service-management/reference/rest/v1/services) is
71*d5c09012SAndroid Build Coastguard Workera network service managed by
72*d5c09012SAndroid Build Coastguard Worker[Google Service Management](/service-management). Each managed service has a
73*d5c09012SAndroid Build Coastguard Workerunique name, such as `example.googleapis.com`, which must be a valid
74*d5c09012SAndroid Build Coastguard Workerfully-qualified DNS name, as per RFC 1035.
75*d5c09012SAndroid Build Coastguard Worker
76*d5c09012SAndroid Build Coastguard WorkerFor example:
77*d5c09012SAndroid Build Coastguard Worker
78*d5c09012SAndroid Build Coastguard Worker* Google Cloud Pub/Sub (`pubsub.googleapis.com`)
79*d5c09012SAndroid Build Coastguard Worker* Google Cloud Vision (`vision.googleapis.com`)
80*d5c09012SAndroid Build Coastguard Worker* Google Cloud Bigtable (`bigtable.googleapis.com`)
81*d5c09012SAndroid Build Coastguard Worker* Google Cloud Datastore (`datastore.googleapis.com`)
82*d5c09012SAndroid Build Coastguard Worker
83*d5c09012SAndroid Build Coastguard WorkerGoogle Service Management manages the lifecycle of each service’s
84*d5c09012SAndroid Build Coastguard Workerconfiguration, which is used to customize Google Service Control's behavior.
85*d5c09012SAndroid Build Coastguard WorkerService configurations are also used by Google Cloud Console
86*d5c09012SAndroid Build Coastguard Workerfor displaying APIs and their settings, enabling/disabling APIs, and more.
87*d5c09012SAndroid Build Coastguard Worker
88*d5c09012SAndroid Build Coastguard Worker## Operations
89*d5c09012SAndroid Build Coastguard Worker
90*d5c09012SAndroid Build Coastguard WorkerGoogle Service Control uses the generic concept of an *operation*
91*d5c09012SAndroid Build Coastguard Workerto represent the
92*d5c09012SAndroid Build Coastguard Workeractivities of a managed service, such as API calls and resource usage. Each
93*d5c09012SAndroid Build Coastguard Workeroperation is associated with a managed service and a specific service
94*d5c09012SAndroid Build Coastguard Workerconsumer, and has a set of properties that describe the operation, such as
95*d5c09012SAndroid Build Coastguard Workerthe API method name and resource usage amount. For more information, see the
96*d5c09012SAndroid Build Coastguard Worker[Operation definition](/service-control/rest/v1/Operation).
97*d5c09012SAndroid Build Coastguard Worker
98*d5c09012SAndroid Build Coastguard Worker## Check
99*d5c09012SAndroid Build Coastguard Worker
100*d5c09012SAndroid Build Coastguard WorkerThe [`services.check`](/service-control/reference/rest/v1/services/check)
101*d5c09012SAndroid Build Coastguard Workermethod determines whether an operation should be allowed to proceed
102*d5c09012SAndroid Build Coastguard Workerfor a managed service.
103*d5c09012SAndroid Build Coastguard Worker
104*d5c09012SAndroid Build Coastguard WorkerFor example:
105*d5c09012SAndroid Build Coastguard Worker
106*d5c09012SAndroid Build Coastguard Worker* Check if the consumer is still active.
107*d5c09012SAndroid Build Coastguard Worker* Check if the consumer has enabled the service.
108*d5c09012SAndroid Build Coastguard Worker* Check if the API key is still valid.
109*d5c09012SAndroid Build Coastguard Worker
110*d5c09012SAndroid Build Coastguard WorkerBy performing multiple checks within a single method call, it provides
111*d5c09012SAndroid Build Coastguard Workerbetter performance, higher reliability, and reduced development cost to
112*d5c09012SAndroid Build Coastguard Workerservice producers compared to checking with multiple backend systems.
113*d5c09012SAndroid Build Coastguard Worker
114*d5c09012SAndroid Build Coastguard Worker## Report
115*d5c09012SAndroid Build Coastguard Worker
116*d5c09012SAndroid Build Coastguard WorkerThe [`services.report`](/service-control/reference/rest/v1/services/report)
117*d5c09012SAndroid Build Coastguard Workermethod reports completed operations for
118*d5c09012SAndroid Build Coastguard Workera managed service to backend systems, such as logging and monitoring. The
119*d5c09012SAndroid Build Coastguard Workerreported data can be seen in Google API Console and Google Cloud Console,
120*d5c09012SAndroid Build Coastguard Workerand retrieved with appropriate APIs, such as the Stackdriver Logging and
121*d5c09012SAndroid Build Coastguard WorkerStackdriver Monitoring APIs.
122*d5c09012SAndroid Build Coastguard Worker
123*d5c09012SAndroid Build Coastguard Worker## Next steps
124*d5c09012SAndroid Build Coastguard Worker
125*d5c09012SAndroid Build Coastguard Worker* Read our [Getting Started guide](/service-control/getting-started) to find out
126*d5c09012SAndroid Build Coastguard Worker  how to set up and use the Google Service Control API.
127