Skip to content

Commit 40ce8a8

Browse files
committed
extend Log; histogram -> DDSketch, openmetrics histogram bucket; add init_config
extend Log: - Add fields to the Log message to support all the metadata the agent and ADP support - The fields map 1:1 onto ADP's internal Log struct Histogram / sketch: - Renamed histogram.proto to sketch.proto and replaced its contents with the DDSketch wire format used by the agent's SketchPayload - CheckData oneof slot 5 is repurposed to carry pre-aggregated sketches Note: lib/saluki-components/src/sources/checks_ipc/mod.rs is left broken — it still imports the old Checks service. init_config: - The check API has both `config` and `init_config`, and many integrations rely on the init_config block for shared defaults - The previous CheckInstance message only carried the per-instance config, so an ACR-scheduled check would receive an empty init_config openmetrics: - Add support for the new openmetrics histogram bucket type
1 parent 550525e commit 40ce8a8

8 files changed

Lines changed: 418 additions & 588 deletions

File tree

lib/protos/datadog/build.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,9 @@ fn main() {
157157
"proto/checks/v1/log.proto",
158158
"proto/checks/v1/service_check.proto",
159159
"proto/checks/v1/event.proto",
160-
"proto/checks/v1/histogram.proto",
160+
"proto/checks/v1/sketch.proto",
161161
"proto/checks/v1/event_platform_event.proto",
162+
"proto/checks/v1/histogram_bucket.proto",
162163
],
163164
&["proto"],
164165
)

lib/protos/datadog/proto/checks/v1/acr_ipc.proto

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,14 @@ message CheckInstance {
4545
string check_name = 1;
4646
string instance_name = 2;
4747
string id = 3;
48+
// The per-instance YAML/JSON block (a single entry from the
49+
// integration's `instances:` list).
4850
bytes config = 4;
51+
// The integration-level YAML/JSON `init_config:` block, shared
52+
// across every instance of this integration. Required for any check
53+
// that reads defaults at Configure time (credentials, base URLs,
54+
// shared tags, etc.).
55+
bytes init_config = 5;
4956
}
5057

5158
// Check data: client -> server (batched)

lib/protos/datadog/proto/checks/v1/checks.proto

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@ package datadog.checks.v1;
44

55
import "checks/v1/event.proto";
66
import "checks/v1/event_platform_event.proto";
7-
import "checks/v1/histogram.proto";
7+
import "checks/v1/histogram_bucket.proto";
88
import "checks/v1/log.proto";
99
import "checks/v1/metric.proto";
1010
import "checks/v1/service_check.proto";
11+
import "checks/v1/sketch.proto";
1112

1213
message CheckData {
1314
oneof data {
1415
datadog.checks.v1.metric.Metric metric = 1;
1516
datadog.checks.v1.log.Log log = 2;
1617
datadog.checks.v1.service_check.ServiceCheck service_check = 3;
1718
datadog.checks.v1.event.Event event = 4;
18-
datadog.checks.v1.histogram.Histogram histogram = 5;
19+
// Slot 5 was previously `histogram` (an unused stub). Repurposed
20+
// to carry pre-aggregated DDSketches; the wire bytes from any
21+
// legacy producer of the old Histogram message would be
22+
// mis-parsed here, so don't rely on cross-version compatibility
23+
// for slot 5 specifically.
24+
datadog.checks.v1.sketch.Sketch sketch = 5;
1925
datadog.checks.v1.event_platform_event.EventPlatformEvent event_platform_event = 6;
26+
datadog.checks.v1.histogram_bucket.HistogramBucket histogram_bucket = 7;
2027
}
2128
}

lib/protos/datadog/proto/checks/v1/histogram.proto

Lines changed: 0 additions & 12 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
syntax = "proto3";
2+
3+
package datadog.checks.v1.histogram_bucket;
4+
5+
// HistogramBucket carries a pre-aggregated histogram bucket produced
6+
// by an OpenMetrics / Prometheus-style integration. It is the wire
7+
// shape for both the agent's `Sender.HistogramBucket` and
8+
// `Sender.OpenmetricsBucket` upcalls (see
9+
// pkg/aggregator/sender/sender.go on the receiving side); the two
10+
// differ only in whether the producer is emitting many buckets per
11+
// (name, tags) context (`HistogramBucket`, multiple_buckets=true) or
12+
// exactly one (`OpenmetricsBucket`, multiple_buckets=false, the
13+
// default for Python `aggregator.submit_histogram_bucket`).
14+
message HistogramBucket {
15+
// Metric name (e.g. "http.request.duration.count").
16+
string name = 1;
17+
18+
// Number of observations counted by this bucket.
19+
int64 value = 2;
20+
21+
// Bucket bounds. For point observations (single-value buckets),
22+
// both bounds carry the same value.
23+
double lower_bound = 3;
24+
double upper_bound = 4;
25+
26+
// True when value increases monotonically across calls and the
27+
// receiver should compute per-bucket deltas client-side. False
28+
// when the producer already emits deltas.
29+
bool monotonic = 5;
30+
31+
// Hostname this bucket was produced on. Empty means "use the
32+
// receiving agent's default hostname".
33+
string hostname = 6;
34+
35+
// Tags in `key:value` form.
36+
repeated string tags = 7;
37+
38+
// When `monotonic=true`, indicates the receiver should emit the
39+
// first observed value rather than wait for a second to compute a
40+
// delta. Producers set this when they know the bucket started from
41+
// zero recently (e.g. a freshly-scraped target).
42+
bool flush_first_value = 8;
43+
44+
// Distinguishes the two sender upcalls. False (the default)
45+
// routes to `Sender.OpenmetricsBucket`; true routes to
46+
// `Sender.HistogramBucket`. Python `submit_histogram_bucket`
47+
// always lands as false.
48+
bool multiple_buckets = 9;
49+
}

lib/protos/datadog/proto/checks/v1/log.proto

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,37 @@ enum LogLevel {
1212
LOG_LEVEL_CRITICAL = 50;
1313
}
1414

15+
// Log carries a single log record produced by an integration check.
16+
//
17+
// Fields 1 and 2 mirror the original minimal shape and stay for backward
18+
// compatibility. Fields 3-8 are additive: proto3 default-empty values are
19+
// wire-compatible with peers that don't populate them.
1520
message Log {
1621
string message = 1;
1722
LogLevel level = 2;
23+
24+
// Integration source name (e.g. "mysql", "http_check"). Used by the
25+
// logs intake to route and tag.
26+
string source = 3;
27+
28+
// Hostname the log was produced on. Empty means "use the receiving
29+
// agent's default hostname".
30+
string hostname = 4;
31+
32+
// Service the log relates to. Surfaces as `service` in the intake.
33+
string service = 5;
34+
35+
// Log-level tags, in `key:value` form (matches the agent's wire
36+
// format used elsewhere). Combined with host / integration tags
37+
// downstream.
38+
repeated string tags = 6;
39+
40+
// Unix-nanosecond timestamp at which the producer believes the log
41+
// event happened. Zero means "stamp at receive time".
42+
int64 timestamp = 7;
43+
44+
// Free-form additional structured fields. Each value is a JSON-encoded
45+
// string so producers can convey arbitrary scalar / array / object
46+
// shapes through a stable wire type.
47+
map<string, string> additional_properties = 8;
1848
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
syntax = "proto3";
2+
3+
package datadog.checks.v1.sketch;
4+
5+
// Sketch carries a pre-aggregated DDSketch produced by a check.
6+
//
7+
// The wire format is aligned with the Datadog Agent's sketch_payload
8+
// format (see DataDog/agent-payload v5 SketchPayload.Sketch.Dogsketch)
9+
// so receivers can convert directly to the agent's internal Sketch
10+
// type without a separate sketches-go round-trip.
11+
message Sketch {
12+
// Metric name (e.g. "http.request.duration").
13+
string name = 1;
14+
15+
// Tags in `key:value` form.
16+
repeated string tags = 2;
17+
18+
// Hostname this sketch was produced on. Empty means "use the
19+
// receiving agent's default hostname".
20+
string hostname = 3;
21+
22+
// Unix-second timestamp at which the producer flushed the sketch.
23+
int64 timestamp = 4;
24+
25+
// Flush interval the producer used; informational only — the
26+
// receiving aggregator stamps its own flush boundary.
27+
uint64 interval_secs = 5;
28+
29+
// The DDSketch body itself, in the agent's bin-encoded shape.
30+
Dogsketch dogsketch = 6;
31+
}
32+
33+
// Dogsketch is the bin-encoded DDSketch payload. Bin keys (k) and
34+
// counts (n) are parallel arrays — k[i] is the bin index and n[i] the
35+
// number of observations in that bin. This matches the Datadog Agent's
36+
// SketchPayload.Sketch.Dogsketch definition exactly.
37+
message Dogsketch {
38+
int64 ts = 1;
39+
int64 cnt = 2;
40+
double min = 3;
41+
double max = 4;
42+
double avg = 5;
43+
double sum = 6;
44+
repeated sint32 k = 7;
45+
repeated uint32 n = 8;
46+
}

0 commit comments

Comments
 (0)