Show / Hide Table of Contents

Class Quota

Quota configuration helps to achieve fairness and budgeting in service usage.

The metric based quota configuration works this way:

  • The service configuration defines a set of metrics.
  • For API calls, the quota.metric_rules maps methods to metrics with corresponding costs.
  • The quota.limits defines limits on the metrics, which will be used for quota checks at runtime.

An example quota configuration in yaml format:

quota: limits:

  • name: apiWriteQpsPerProject metric: library.googleapis.com/write_calls unit: "1/min/{project}" # rate limit for consumer projects values: STANDARD: 10000

The metric rules bind all methods to the read_calls metric,

except for the UpdateBook and DeleteBook methods. These two methods

are mapped to the write_calls metric, with the UpdateBook method

consuming at twice rate as the DeleteBook method.

metric_rules:

  • selector: "*" metric_costs: library.googleapis.com/read_calls: 1
  • selector: google.example.library.v1.LibraryService.UpdateBook metric_costs: library.googleapis.com/write_calls: 2
  • selector: google.example.library.v1.LibraryService.DeleteBook metric_costs: library.googleapis.com/write_calls: 1

Corresponding Metric definition:

metrics:

  • name: library.googleapis.com/read_calls display_name: Read requests metric_kind: DELTA value_type: INT64

  • name: library.googleapis.com/write_calls display_name: Write requests metric_kind: DELTA value_type: INT64

Inheritance
System.Object
Quota
Implements
IMessage<Quota>
IMessage
System.IEquatable<Quota>
IDeepCloneable<Quota>
Inherited Members
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: Google.Api
Assembly: Google.Api.CommonProtos.dll
Syntax
public sealed class Quota : IMessage<Quota>, IMessage, IEquatable<Quota>, IDeepCloneable<Quota>

Constructors

Quota()

Declaration
public Quota()

Quota(Quota)

Declaration
public Quota(Quota other)
Parameters
Type Name Description
Quota other

Fields

LimitsFieldNumber

Field number for the "limits" field.

Declaration
public const int LimitsFieldNumber = 3
Field Value
Type Description
System.Int32

MetricRulesFieldNumber

Field number for the "metric_rules" field.

Declaration
public const int MetricRulesFieldNumber = 4
Field Value
Type Description
System.Int32

Properties

Descriptor

Declaration
public static MessageDescriptor Descriptor { get; }
Property Value
Type Description
MessageDescriptor

Limits

List of QuotaLimit definitions for the service.

Declaration
public RepeatedField<QuotaLimit> Limits { get; }
Property Value
Type Description
RepeatedField<QuotaLimit>

MetricRules

List of MetricRule definitions, each one mapping a selected method to one or more metrics.

Declaration
public RepeatedField<MetricRule> MetricRules { get; }
Property Value
Type Description
RepeatedField<MetricRule>

Parser

Declaration
public static MessageParser<Quota> Parser { get; }
Property Value
Type Description
MessageParser<Quota>

Methods

CalculateSize()

Declaration
public int CalculateSize()
Returns
Type Description
System.Int32
Implements
IMessage.CalculateSize()

Clone()

Declaration
public Quota Clone()
Returns
Type Description
Quota
Implements
IDeepCloneable<T>.Clone()

Equals(Quota)

Declaration
public bool Equals(Quota other)
Parameters
Type Name Description
Quota other
Returns
Type Description
System.Boolean
Implements
System.IEquatable<T>.Equals(T)

Equals(Object)

Declaration
public override bool Equals(object other)
Parameters
Type Name Description
System.Object other
Returns
Type Description
System.Boolean
Overrides
System.Object.Equals(System.Object)

GetHashCode()

Declaration
public override int GetHashCode()
Returns
Type Description
System.Int32
Overrides
System.Object.GetHashCode()

MergeFrom(Quota)

Declaration
public void MergeFrom(Quota other)
Parameters
Type Name Description
Quota other
Implements
IMessage<T>.MergeFrom(T)

MergeFrom(CodedInputStream)

Declaration
public void MergeFrom(CodedInputStream input)
Parameters
Type Name Description
CodedInputStream input
Implements
IMessage.MergeFrom(CodedInputStream)

ToString()

Declaration
public override string ToString()
Returns
Type Description
System.String
Overrides
System.Object.ToString()

WriteTo(CodedOutputStream)

Declaration
public void WriteTo(CodedOutputStream output)
Parameters
Type Name Description
CodedOutputStream output
Implements
IMessage.WriteTo(CodedOutputStream)

Explicit Interface Implementations

IMessage.Descriptor

Declaration
MessageDescriptor IMessage.Descriptor { get; }
Returns
Type Description
MessageDescriptor
Implements
IMessage.Descriptor
Back to top