Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into hasan.mahmood/add-e…
Browse files Browse the repository at this point in the history
…cs-tasks
  • Loading branch information
hmahmood committed Sep 24, 2024
2 parents 15f5ba7 + 3e2b8a6 commit b9f47f5
Show file tree
Hide file tree
Showing 7 changed files with 144 additions and 1,052 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Payload format description for communication between the Agent and the Datadog b

This repository includes the protocol-buffer IDL used by the agent6 and agent7 to communicate with the Datadog backend.
Those payloads are only supported by the V2 API endpoints.
The generated Go, Python and Java implementations are checked into this repository and can be used directly.
The generated Go, and Java implementations are checked into this repository and can be used directly. Other consumers may copy the `.proto` files into their repository and generate their own bindings.

# Prerequisites

Expand All @@ -27,7 +27,6 @@ The following implementations are available:
The metrics payload is defined in [`proto/metrics/agent_payload.proto`](./proto/metrics/agent_payload.proto).
The following implementations are available:
* Go (gogofast): [github.com/DataDog/agent-payload/gogen](https://pkg.go.dev/github.com/DataDog/agent-payload/gogen)
* Python: [`python/agent_payload_pb2.py`](./python/agent_payload_pb2.py)

## Process

Expand Down
3 changes: 0 additions & 3 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,6 @@ BASH
PATH=#{toolchain_bin_dir} #{protoc_binary} --proto_path=$GOPATH/src:#{gogo_include}:#{toolchain_include_dir}:. --gogofast_out=$GOPATH/src proto/metrics/agent_payload.proto
echo "done"
echo "Generating metrics proto (python)"
PATH=#{toolchain_bin_dir} #{protoc_legacy_binary} --proto_path=#{toolchain_legacy_include_dir}:#{gogo_include}:./proto/metrics --python_out=python agent_payload.proto
echo "Generating process proto (go)"
PATH=#{toolchain_bin_dir} #{protoc_binary} --proto_path=#{toolchain_include_dir}:#{gogo_include}:. --gogofaster_out=$GOPATH/src proto/process/*.proto
Expand Down
200 changes: 101 additions & 99 deletions autoscaling/kubernetes/autoscaling.pb.go

Large diffs are not rendered by default.

40 changes: 22 additions & 18 deletions jsonschema/WorkloadValuesList.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@
"items": {
"$ref": "#/definitions/ResourceList"
},
"additionalProperties": false,
"type": "array"
},
"limits": {
"items": {
"$ref": "#/definitions/ResourceList"
},
"additionalProperties": false,
"type": "array"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Container Resources"
},
Expand All @@ -37,7 +39,7 @@
"type": "string"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Error",
"description": "Error represents an error message"
Expand All @@ -57,7 +59,7 @@
"description": "Value is stored in Kubernetes format (e.g. \"1Gi\")"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Resource List"
},
Expand All @@ -77,29 +79,29 @@
"description": "Replicas is the number of replicas the workload should have"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Horizontal Data"
},
"WorkloadHorizontalValues": {
"properties": {
"error": {
"$ref": "#/definitions/Error",
"additionalProperties": true,
"additionalProperties": false,
"description": "Error is the error message if new values cannot be calculated"
},
"manual": {
"$ref": "#/definitions/WorkloadHorizontalData",
"additionalProperties": true,
"additionalProperties": false,
"description": "Manual is the manual override values for the workload"
},
"auto": {
"$ref": "#/definitions/WorkloadHorizontalData",
"additionalProperties": true,
"additionalProperties": false,
"description": "Auto is the periodic recommendation values for the workload"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Horizontal Values"
},
Expand All @@ -119,19 +121,19 @@
},
"error": {
"$ref": "#/definitions/Error",
"additionalProperties": true,
"additionalProperties": false,
"description": "Error is any global error that prevent the calculation of new values (not specific to horizontal or vertical values)"
},
"horizontal": {
"$ref": "#/definitions/WorkloadHorizontalValues",
"additionalProperties": true
"additionalProperties": false
},
"vertical": {
"$ref": "#/definitions/WorkloadVerticalValues",
"additionalProperties": true
"additionalProperties": false
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Values",
"description": "WorkloadValues represents the values of a workload"
Expand All @@ -142,10 +144,11 @@
"items": {
"$ref": "#/definitions/WorkloadValues"
},
"additionalProperties": false,
"type": "array"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Values List",
"description": "WorkloadValuesList represents a list of workload values"
Expand All @@ -165,33 +168,34 @@
"items": {
"$ref": "#/definitions/ContainerResources"
},
"additionalProperties": false,
"type": "array",
"description": "Resources is the list of resources for the workload"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Vertical Data"
},
"WorkloadVerticalValues": {
"properties": {
"error": {
"$ref": "#/definitions/Error",
"additionalProperties": true,
"additionalProperties": false,
"description": "Error is the error message if new values cannot be calculated"
},
"manual": {
"$ref": "#/definitions/WorkloadVerticalData",
"additionalProperties": true,
"additionalProperties": false,
"description": "Manual is the manual override values for the workload"
},
"auto": {
"$ref": "#/definitions/WorkloadVerticalData",
"additionalProperties": true,
"additionalProperties": false,
"description": "Auto is the periodic recommendation values for the workload"
}
},
"additionalProperties": true,
"additionalProperties": false,
"type": "object",
"title": "Workload Vertical Values"
}
Expand Down
9 changes: 9 additions & 0 deletions jsonschema/embed.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// package jsonschema embeds the JSON schema for external usage
package jsonschema

import (
_ "embed"
)

//go:embed WorkloadValuesList.json
var KubernetesAutoscalingWorkloadValuesList []byte
11 changes: 11 additions & 0 deletions proto/autoscaling/kubernetes/autoscaling.proto
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "proto/deps/github.com/chrusty/protoc-gen-jsonschema/options.proto";

// Error represents an error message
message Error {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

optional int32 code = 1;
Expand All @@ -17,11 +18,14 @@ message Error {

// WorkloadValuesList represents a list of workload values
message WorkloadValuesList {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;

repeated WorkloadValues values = 1;
}

// WorkloadValues represents the values of a workload
message WorkloadValues {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

string namespace = 1 [(protoc.gen.jsonschema.field_options).required = true]; // Namespace is the namespace of PodAutoscaler object
Expand All @@ -34,6 +38,7 @@ message WorkloadValues {
}

message WorkloadHorizontalValues {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

Error error = 1; // Error is the error message if new values cannot be calculated
Expand All @@ -44,12 +49,14 @@ message WorkloadHorizontalValues {

message WorkloadHorizontalData {
option (protoc.gen.jsonschema.message_options).ignore = true;
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;

google.protobuf.Timestamp timestamp = 1 [(protoc.gen.jsonschema.field_options).required = true]; // Timestamp is the time the values were generated
optional int32 replicas = 2 [(protoc.gen.jsonschema.field_options).required = true]; // Replicas is the number of replicas the workload should have
}

message WorkloadVerticalValues {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

Error error = 1; // Error is the error message if new values cannot be calculated
Expand All @@ -59,16 +66,20 @@ message WorkloadVerticalValues {
}

message WorkloadVerticalData {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

google.protobuf.Timestamp timestamp = 1 [(protoc.gen.jsonschema.field_options).required = true]; // Timestamp is the time the values were generated
repeated ContainerResources resources = 2 [(protoc.gen.jsonschema.field_options).required = true]; // Resources is the list of resources for the workload
}

message ContainerResources {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;
option (protoc.gen.jsonschema.message_options).ignore = true;

message ResourceList {
option (protoc.gen.jsonschema.message_options).disallow_additional_properties = true;

string name = 1 [(protoc.gen.jsonschema.field_options).required = true]; // Name is the name of the resource (e.g. "cpu" or "memory")
string value = 2 [(protoc.gen.jsonschema.field_options).required = true]; // Value is stored in Kubernetes format (e.g. "1Gi")
}
Expand Down
Loading

0 comments on commit b9f47f5

Please sign in to comment.