Skip to content

Commit

Permalink
Add the ORCA load report definition
Browse files Browse the repository at this point in the history
We don't actually use it yet.
  • Loading branch information
edsko committed Mar 28, 2024
1 parent acabb65 commit 61111bc
Show file tree
Hide file tree
Showing 9 changed files with 1,349 additions and 1 deletion.
2 changes: 1 addition & 1 deletion dev/genproto.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ protoc \
ping.proto

##
## Examples and test cases from the gRPC repo
## From the gRPC repo
##

for i in dev/grpc-proto/*.proto
Expand Down
64 changes: 64 additions & 0 deletions dev/grpc-proto/orca_load_report.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
// Copyright 2020 The gRPC Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// Local copy of Envoy xDS proto file, used for testing only.

syntax = "proto3";

package xds.data.orca.v3;

// See section `ORCA load report format` of the design document in
// :ref:`https://github.com/envoyproxy/envoy/issues/6614`.

message OrcaLoadReport {
// CPU utilization expressed as a fraction of available CPU resources. This
// should be derived from the latest sample or measurement. The value may be
// larger than 1.0 when the usage exceeds the reporter dependent notion of
// soft limits.
double cpu_utilization = 1;

// Memory utilization expressed as a fraction of available memory
// resources. This should be derived from the latest sample or measurement.
double mem_utilization = 2;

// Total RPS being served by an endpoint. This should cover all services that an endpoint is
// responsible for.
uint64 rps = 3 [deprecated = true];

// Application specific requests costs. Each value is an absolute cost (e.g. 3487 bytes of
// storage) associated with the request.
map<string, double> request_cost = 4;

// Resource utilization values. Each value is expressed as a fraction of total resources
// available, derived from the latest sample or measurement.
map<string, double> utilization = 5;

double rps_fractional = 6;

// Total EPS (errors/second) being served by an endpoint. This should cover
// all services that an endpoint is responsible for.
double eps = 7;

// Application specific opaque metrics.
map<string, double> named_metrics = 8;

// Application specific utilization expressed as a fraction of available
// resources. For example, an application may report the max of CPU and memory
// utilization for better load balancing if it is both CPU and memory bound.
// This should be derived from the latest sample or measurement.
// The value may be larger than 1.0 when the usage exceeds the reporter
// dependent notion of soft limits.
double application_utilization = 9;
}

5 changes: 5 additions & 0 deletions grapesy.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,15 @@ library

Paths_grapesy

Proto.OrcaLoadReport
Proto.OrcaLoadReport_Fields

-- TODO: Should move to its own package
Control.Monad.XIO
hs-source-dirs:
src
xio
proto
build-depends:
, async >= 2.2 && < 2.3
, base16-bytestring >= 1.0 && < 1.1
Expand All @@ -177,6 +181,7 @@ library
, pipes >= 4.3 && < 4.4
, pipes-safe >= 2.3 && < 2.4
, proto-lens >= 0.7 && < 0.8
, proto-lens-runtime >= 0.7 && < 0.8
, random >= 1.2 && < 1.3
, stm >= 2.5 && < 2.6
, text >= 1.2 && < 2.1
Expand Down
1 change: 1 addition & 0 deletions proto/Proto/Empty_Fields.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# OPTIONS_GHC -Wno-unused-imports#-}
{-# OPTIONS_GHC -Wno-duplicate-exports#-}
{-# OPTIONS_GHC -Wno-dodgy-exports#-}
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
module Proto.Empty_Fields where
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
Expand Down
1 change: 1 addition & 0 deletions proto/Proto/Messages_Fields.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# OPTIONS_GHC -Wno-unused-imports#-}
{-# OPTIONS_GHC -Wno-duplicate-exports#-}
{-# OPTIONS_GHC -Wno-dodgy-exports#-}
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
module Proto.Messages_Fields where
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
Expand Down
1,182 changes: 1,182 additions & 0 deletions proto/Proto/OrcaLoadReport.hs

Large diffs are not rendered by default.

93 changes: 93 additions & 0 deletions proto/Proto/OrcaLoadReport_Fields.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
{- This file was auto-generated from orca_load_report.proto by the proto-lens-protoc program. -}
{-# LANGUAGE ScopedTypeVariables, DataKinds, TypeFamilies, UndecidableInstances, GeneralizedNewtypeDeriving, MultiParamTypeClasses, FlexibleContexts, FlexibleInstances, PatternSynonyms, MagicHash, NoImplicitPrelude, DataKinds, BangPatterns, TypeApplications, OverloadedStrings, DerivingStrategies#-}
{-# OPTIONS_GHC -Wno-unused-imports#-}
{-# OPTIONS_GHC -Wno-duplicate-exports#-}
{-# OPTIONS_GHC -Wno-dodgy-exports#-}
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
module Proto.OrcaLoadReport_Fields where
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
import qualified Data.ProtoLens.Runtime.Data.Monoid as Data.Monoid
import qualified Data.ProtoLens.Runtime.Data.Word as Data.Word
import qualified Data.ProtoLens.Runtime.Data.ProtoLens as Data.ProtoLens
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Bytes as Data.ProtoLens.Encoding.Bytes
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Growing as Data.ProtoLens.Encoding.Growing
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Parser.Unsafe as Data.ProtoLens.Encoding.Parser.Unsafe
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Encoding.Wire as Data.ProtoLens.Encoding.Wire
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Field as Data.ProtoLens.Field
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Message.Enum as Data.ProtoLens.Message.Enum
import qualified Data.ProtoLens.Runtime.Data.ProtoLens.Service.Types as Data.ProtoLens.Service.Types
import qualified Data.ProtoLens.Runtime.Lens.Family2 as Lens.Family2
import qualified Data.ProtoLens.Runtime.Lens.Family2.Unchecked as Lens.Family2.Unchecked
import qualified Data.ProtoLens.Runtime.Data.Text as Data.Text
import qualified Data.ProtoLens.Runtime.Data.Map as Data.Map
import qualified Data.ProtoLens.Runtime.Data.ByteString as Data.ByteString
import qualified Data.ProtoLens.Runtime.Data.ByteString.Char8 as Data.ByteString.Char8
import qualified Data.ProtoLens.Runtime.Data.Text.Encoding as Data.Text.Encoding
import qualified Data.ProtoLens.Runtime.Data.Vector as Data.Vector
import qualified Data.ProtoLens.Runtime.Data.Vector.Generic as Data.Vector.Generic
import qualified Data.ProtoLens.Runtime.Data.Vector.Unboxed as Data.Vector.Unboxed
import qualified Data.ProtoLens.Runtime.Text.Read as Text.Read
applicationUtilization ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "applicationUtilization" a) =>
Lens.Family2.LensLike' f s a
applicationUtilization
= Data.ProtoLens.Field.field @"applicationUtilization"
cpuUtilization ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "cpuUtilization" a) =>
Lens.Family2.LensLike' f s a
cpuUtilization = Data.ProtoLens.Field.field @"cpuUtilization"
eps ::
forall f s a.
(Prelude.Functor f, Data.ProtoLens.Field.HasField s "eps" a) =>
Lens.Family2.LensLike' f s a
eps = Data.ProtoLens.Field.field @"eps"
key ::
forall f s a.
(Prelude.Functor f, Data.ProtoLens.Field.HasField s "key" a) =>
Lens.Family2.LensLike' f s a
key = Data.ProtoLens.Field.field @"key"
memUtilization ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "memUtilization" a) =>
Lens.Family2.LensLike' f s a
memUtilization = Data.ProtoLens.Field.field @"memUtilization"
namedMetrics ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "namedMetrics" a) =>
Lens.Family2.LensLike' f s a
namedMetrics = Data.ProtoLens.Field.field @"namedMetrics"
requestCost ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "requestCost" a) =>
Lens.Family2.LensLike' f s a
requestCost = Data.ProtoLens.Field.field @"requestCost"
rps ::
forall f s a.
(Prelude.Functor f, Data.ProtoLens.Field.HasField s "rps" a) =>
Lens.Family2.LensLike' f s a
rps = Data.ProtoLens.Field.field @"rps"
rpsFractional ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "rpsFractional" a) =>
Lens.Family2.LensLike' f s a
rpsFractional = Data.ProtoLens.Field.field @"rpsFractional"
utilization ::
forall f s a.
(Prelude.Functor f,
Data.ProtoLens.Field.HasField s "utilization" a) =>
Lens.Family2.LensLike' f s a
utilization = Data.ProtoLens.Field.field @"utilization"
value ::
forall f s a.
(Prelude.Functor f, Data.ProtoLens.Field.HasField s "value" a) =>
Lens.Family2.LensLike' f s a
value = Data.ProtoLens.Field.field @"value"
1 change: 1 addition & 0 deletions proto/Proto/Ping_Fields.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# OPTIONS_GHC -Wno-unused-imports#-}
{-# OPTIONS_GHC -Wno-duplicate-exports#-}
{-# OPTIONS_GHC -Wno-dodgy-exports#-}
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
module Proto.Ping_Fields where
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
Expand Down
1 change: 1 addition & 0 deletions proto/Proto/Test_Fields.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# OPTIONS_GHC -Wno-unused-imports#-}
{-# OPTIONS_GHC -Wno-duplicate-exports#-}
{-# OPTIONS_GHC -Wno-dodgy-exports#-}
{-# OPTIONS_GHC -Wno-prepositive-qualified-module #-}
module Proto.Test_Fields where
import qualified Data.ProtoLens.Runtime.Prelude as Prelude
import qualified Data.ProtoLens.Runtime.Data.Int as Data.Int
Expand Down

0 comments on commit 61111bc

Please sign in to comment.