|
| 1 | +// Vendored from: |
| 2 | +// https://github.com/DataDog/agent-payload/blob/512d523e386f75077efe9e8d878284104d491f46/proto/metrics/intake_v3.proto |
| 3 | +// |
| 4 | +// This is the wire format that `libdd-metrics-v3`'s hand-rolled encoder (see `src/writer.rs`) |
| 5 | +// implements without a Protocol Buffers library. `.github/workflows/verify-metrics-v3-proto.yml` |
| 6 | +// checks in CI that the content below stays byte-for-byte identical to the pinned commit above, |
| 7 | +// and `tests/parity.rs` checks that our hand-rolled encoder's output is byte-identical to what |
| 8 | +// prost's generated bindings for this file produce from the same data. |
| 9 | + |
| 10 | +syntax = "proto3"; |
| 11 | + |
| 12 | +package datadoghq.api.metrics.v3; |
| 13 | + |
| 14 | +option go_package = "github.com/DataDog/agent-payload/v5/metrics/intake_v3"; |
| 15 | + |
| 16 | +message Payload { |
| 17 | + reserved 1; // for compatibility with agentpayload.MetricPayload.series |
| 18 | + Metadata metadata = 2; |
| 19 | + MetricData metricData = 3; |
| 20 | +} |
| 21 | + |
| 22 | +message Metadata { |
| 23 | + repeated string tags = 1; |
| 24 | + repeated string resources = 2; // even number of elements, [Type, Name] pairs |
| 25 | +} |
| 26 | + |
| 27 | +message MetricData { |
| 28 | + // Dictionaries |
| 29 | + // All dictionary indexes are base-1, zero implicitly represents an empty value. |
| 30 | + bytes dictNameStr = 1; // varint length + value |
| 31 | + bytes dictTagStr = 2; // varint length + value |
| 32 | + repeated sint64 dictTagsets = 3; // length, delta encoded set of indexes into dictTagsStr |
| 33 | + |
| 34 | + bytes dictResourceStr = 4; // varint length + value |
| 35 | + repeated int64 dictResourceLen = 5; // number of elements in Type and Name arrays |
| 36 | + repeated sint64 dictResourceType = 6; // delta encoded set of indexes into dictResourceStr |
| 37 | + repeated sint64 dictResourceName = 7; // delta encoded set of indexes into dictResourceStr |
| 38 | + |
| 39 | + bytes dictSourceTypeName = 8; // varint length + value |
| 40 | + repeated int32 dictOriginInfo = 9; // (product, category, service) tuples |
| 41 | + bytes dictUnitStr = 25; // varint length + value |
| 42 | + |
| 43 | + // One entry per time series |
| 44 | + repeated uint64 types = 10; // type = metricType | valueType | metricFlags |
| 45 | + repeated sint64 nameRefs = 11; // index into dictNameStr, entire array is delta encoded |
| 46 | + repeated sint64 tagsetRefs = 12; // index into dictTagsets, entire array is delta encoded |
| 47 | + repeated sint64 resourcesRefs = 13; // index into dictResourceLen, entire array is delta encoded |
| 48 | + repeated uint64 intervals = 14; |
| 49 | + repeated uint64 numPoints = 15; |
| 50 | + repeated sint64 sourceTypeNameRefs = 23; // index into dictSourceTypeName, entire array is delta encoded |
| 51 | + repeated sint64 originInfoRefs = 24; // index into dictOriginInfo, entire array is delta encoded |
| 52 | + repeated sint64 unitRefs = 26; // index into dictUnitStr, value present if flagHasUnit is set, entire array is delta encoded |
| 53 | + |
| 54 | + // each metric has numPoints values in this section |
| 55 | + repeated sint64 timestamps = 16; // entire array delta encoded |
| 56 | + repeated sint64 valsSint64 = 17; // or |
| 57 | + repeated float valsFloat32 = 18; // or |
| 58 | + repeated double valsFloat64 = 19; // based on valueType |
| 59 | + repeated uint64 sketchNumBins = 20; |
| 60 | + repeated sint32 sketchBinKeys = 21; // per-metric sequence is delta encoded |
| 61 | + repeated uint32 sketchBinCnts = 22; |
| 62 | + // sketch summary Sum, Min, Max are encoded as three consecutive elements in one of vals using valueType |
| 63 | + // sketch summary Cnt is always encoded in valInt64 |
| 64 | + // sketch summary Avg is reconstructed as Sum/Cnt in the intake |
| 65 | +} |
| 66 | + |
| 67 | +enum metricType { |
| 68 | + UNUSED = 0; |
| 69 | + Count = 1; |
| 70 | + Rate = 2; |
| 71 | + Gauge = 3; |
| 72 | + Sketch = 4; |
| 73 | +} |
| 74 | + |
| 75 | +enum valueType { |
| 76 | + Zero = 0x00; // value is zero, not stored explicitly |
| 77 | + Sint64 = 0x10; // value is stored in valsSint64 |
| 78 | + Float32 = 0x20; // value is stored in valsFloat32 |
| 79 | + Float64 = 0x30; // value is stored in valsFloat64 |
| 80 | +} |
| 81 | + |
| 82 | +enum metricFlags { |
| 83 | + flagNone = 0; |
| 84 | + flagNoIndex = 0x100; // metric should not be indexed (equivalent to origin metric type == agent_hidden in v2) |
| 85 | + flagHasUnit = 0x200; // timeseries has a unit in the unitRefs column |
| 86 | +} |
| 87 | + |
| 88 | +message Response { |
| 89 | + string error = 1; |
| 90 | +} |
0 commit comments