From ccd7f86452aaecda89bd3ad1a3127079e967e43d Mon Sep 17 00:00:00 2001 From: Raymond Zhao Date: Mon, 10 Feb 2025 18:30:12 +0000 Subject: [PATCH] Update protos Signed-off-by: Raymond Zhao --- lib/datadog-protos/build.rs | 2 + .../proto/datadog/api/v1/api.proto | 33 ++++++++++++++ .../datadog/autodiscovery/autodiscovery.proto | 44 +++++++++++++++++++ .../proto/datadog/model/v1/model.proto | 39 ++++++++++++++-- lib/datadog-protos/src/lib.rs | 1 + 5 files changed, 116 insertions(+), 3 deletions(-) create mode 100644 lib/datadog-protos/proto/datadog/autodiscovery/autodiscovery.proto diff --git a/lib/datadog-protos/build.rs b/lib/datadog-protos/build.rs index 7bb5699c..81bc9e92 100644 --- a/lib/datadog-protos/build.rs +++ b/lib/datadog-protos/build.rs @@ -8,6 +8,7 @@ fn main() { println!("cargo:rerun-if-changed=proto/datadog/api/v1/api.proto"); println!("cargo:rerun-if-changed=proto/datadog/workloadmeta/workloadmeta.proto"); println!("cargo:rerun-if-changed=proto/datadog/remoteagent/remoteagent.proto"); + println!("cargo:rerun-if-changed=proto/datadog/autodiscovery/autodiscovery.proto"); // Handle code generation for pure Protocol Buffers message types. let codegen_customize = protobuf_codegen::Customize::default() @@ -38,6 +39,7 @@ fn main() { "proto/datadog/api/v1/api.proto", "proto/datadog/workloadmeta/workloadmeta.proto", "proto/datadog/remoteagent/remoteagent.proto", + "proto/datadog/autodiscovery/autodiscovery.proto", ], &["proto"], ) diff --git a/lib/datadog-protos/proto/datadog/api/v1/api.proto b/lib/datadog-protos/proto/datadog/api/v1/api.proto index f6c16ff4..d6ef3bae 100644 --- a/lib/datadog-protos/proto/datadog/api/v1/api.proto +++ b/lib/datadog-protos/proto/datadog/api/v1/api.proto @@ -6,6 +6,7 @@ import "datadog/model/v1/model.proto"; import "datadog/remoteagent/remoteagent.proto"; import "datadog/remoteconfig/remoteconfig.proto"; import "datadog/workloadmeta/workloadmeta.proto"; +import "datadog/autodiscovery/autodiscovery.proto"; import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; @@ -50,6 +51,22 @@ service AgentSecure { }; }; + // Generates a container ID from Origin Info. + // can be called through the HTTP gateway, and entity will be returned as JSON: + // $ curl -H "authorization: Bearer $(cat /etc/datadog-agent/auth_token)" \ + // -XPOST -k -H "Content-Type: application/json" \ + // --data '{"externalData": {"init": false,"containerName": "dd-trace-py","podUID": "c4b45c6a-b296-4bd5-88df-7c2d6bcaabef"}}' \ + // https://localhost:5001/v1/grpc/tagger/generate_container_id_from_origin_info + // { + // "containerID":"c9fd60251b5237467462dad48999815eb0025f367c6e1abe91e0bd787d5915fc" + // } + rpc TaggerGenerateContainerIDFromOriginInfo(datadog.model.v1.GenerateContainerIDFromOriginInfoRequest) returns (datadog.model.v1.GenerateContainerIDFromOriginInfoResponse) { + option (google.api.http) = { + post: "/v1/grpc/tagger/generate_container_id_from_origin_info" + body: "*" + }; + }; + // fetches an entity from the Tagger with the desired cardinality tags. // can be called through the HTTP gateway, and entity will be returned as JSON: // $ curl -H "authorization: Bearer $(cat /etc/datadog-agent/auth_token)" \ @@ -153,6 +170,22 @@ service AgentSecure { body: "*" }; }; + + // Subscribes to autodiscovery config updates + rpc AutodiscoveryStreamConfig(google.protobuf.Empty) returns (stream datadog.autodiscovery.AutodiscoveryStreamResponse) { + option (google.api.http) = { + post: "/v1/grpc/autodiscovery/stream_configs" + body: "*" + }; + }; + + // Get the host tags + rpc GetHostTags(datadog.model.v1.HostTagRequest) returns (datadog.model.v1.HostTagReply) { + option (google.api.http) = { + get: "/v1/grpc/host_tags" + }; + }; + } // Service exposed by remote agents to allow querying by the Core Agent. diff --git a/lib/datadog-protos/proto/datadog/autodiscovery/autodiscovery.proto b/lib/datadog-protos/proto/datadog/autodiscovery/autodiscovery.proto new file mode 100644 index 00000000..24197475 --- /dev/null +++ b/lib/datadog-protos/proto/datadog/autodiscovery/autodiscovery.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; + +package datadog.autodiscovery; + +option go_package = "pkg/proto/pbgo/core"; // golang\ + +enum ConfigEventType { + SCHEDULE = 0; + UNSCHEDULE = 1; +} + +message KubeNamespacedName { + string name = 1; + string namespace = 2; +} + +message AdvancedADIdentifier { + KubeNamespacedName kubeService = 1; + KubeNamespacedName kubeEndpoints = 2; +} + +message Config { + string name = 1; + repeated bytes instances = 2; + bytes initConfig = 3; + bytes metricConfig = 4; + bytes logsConfig = 5; + repeated string adIdentifiers = 6; + repeated AdvancedADIdentifier advancedAdIdentifiers = 7; + string provider = 8; + string serviceId = 9; + string taggerEntity = 10; + bool clusterCheck = 11; + string nodeName = 12; + string source = 13; + bool ignoreAutodiscoveryTags = 14; + bool metricsExcluded = 15; + bool logsExcluded = 16; + ConfigEventType eventType = 17; +} + +message AutodiscoveryStreamResponse { + repeated Config configs = 1; +} diff --git a/lib/datadog-protos/proto/datadog/model/v1/model.proto b/lib/datadog-protos/proto/datadog/model/v1/model.proto index aae1416c..d7c397ee 100644 --- a/lib/datadog-protos/proto/datadog/model/v1/model.proto +++ b/lib/datadog-protos/proto/datadog/model/v1/model.proto @@ -14,6 +14,13 @@ message HostnameReply { string hostname = 1; } +message HostTagRequest {} + +message HostTagReply { + repeated string system = 1; + repeated string googleCloudPlatform = 2; +} + // Dogstatsd capture types message CaptureTriggerRequest { @@ -31,8 +38,10 @@ message CaptureTriggerResponse { message StreamTagsRequest { TagCardinality cardinality = 1; - Filter includeFilter = 2; - Filter excludeFilter = 3; + DeprecatedFilter includeFilter = 2; + DeprecatedFilter excludeFilter = 3; + repeated string prefixes = 4; + string streamingID = 5; } message StreamTagsResponse { @@ -56,7 +65,7 @@ enum TagCardinality { HIGH = 2; } -message Filter { +message DeprecatedFilter { string kubeNamespace = 1; string image = 2; string containerName = 3; @@ -71,6 +80,30 @@ message Entity { repeated string standardTags = 6; } +message GenerateContainerIDFromOriginInfoRequest { + // Nested message for the local data + message LocalData { + optional uint32 processID = 1; // Process ID of the container process on the host. + optional string containerID = 2; // Container ID send from the client. + optional uint64 inode = 3; // Cgroup inode of the container. + optional string podUID = 4; // Pod UID send from the client. + } + + // Nested message for the external data + message ExternalData { + optional bool init = 1; // Init is true if the container is an init container. + optional string containerName = 2; // Container name in the Kubernetes Pod spec. + optional string podUID = 3; // Pod UID in the Kubernetes Pod spec. + } + + optional LocalData localData = 1; // Local data for the container, generated by the client. + optional ExternalData externalData = 2; // External data for the container, generated by the Admission Controller. +} + +message GenerateContainerIDFromOriginInfoResponse { + string containerID = 1; +} + message FetchEntityRequest { EntityId id = 1; TagCardinality cardinality = 2; diff --git a/lib/datadog-protos/src/lib.rs b/lib/datadog-protos/src/lib.rs index 61e1e2da..f9d999af 100644 --- a/lib/datadog-protos/src/lib.rs +++ b/lib/datadog-protos/src/lib.rs @@ -31,6 +31,7 @@ pub mod agent { pub use super::agent_include::datadog::api::v1::agent_secure_client::AgentSecureClient; pub use super::agent_include::datadog::api::v1::remote_agent_server::RemoteAgent; pub use super::agent_include::datadog::api::v1::remote_agent_server::RemoteAgentServer; + pub use super::agent_include::datadog::autodiscovery::*; pub use super::agent_include::datadog::model::v1::*; pub use super::agent_include::datadog::remoteagent::*; pub use super::agent_include::datadog::workloadmeta::*;