Skip to content

Commit

Permalink
Update protos
Browse files Browse the repository at this point in the history
Signed-off-by: Raymond Zhao <raymond.zhao@datadoghq.com>
  • Loading branch information
rayz committed Feb 10, 2025
1 parent 535a88b commit ccd7f86
Show file tree
Hide file tree
Showing 5 changed files with 116 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lib/datadog-protos/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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"],
)
Expand Down
33 changes: 33 additions & 0 deletions lib/datadog-protos/proto/datadog/api/v1/api.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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)" \
Expand Down Expand Up @@ -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.
Expand Down
44 changes: 44 additions & 0 deletions lib/datadog-protos/proto/datadog/autodiscovery/autodiscovery.proto
Original file line number Diff line number Diff line change
@@ -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;
}
39 changes: 36 additions & 3 deletions lib/datadog-protos/proto/datadog/model/v1/model.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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 {
Expand All @@ -56,7 +65,7 @@ enum TagCardinality {
HIGH = 2;
}

message Filter {
message DeprecatedFilter {
string kubeNamespace = 1;
string image = 2;
string containerName = 3;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions lib/datadog-protos/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::*;
Expand Down

0 comments on commit ccd7f86

Please sign in to comment.