|
5 | 5 |
|
6 | 6 | package com.example.otelstef |
7 | 7 |
|
| 8 | +//////////////////////////////////////////////////////////////// |
| 9 | +// Schema that is common across all signals. |
| 10 | +//////////////////////////////////////////////////////////////// |
| 11 | + |
8 | 12 | multimap Attributes { |
9 | | - key string dict(AttributeKey) |
| 13 | + key string dict(AttributeKey) |
10 | 14 | value AnyValue |
11 | 15 | } |
12 | 16 |
|
13 | | -multimap EnvelopeAttributes { |
14 | | - key string |
15 | | - value bytes |
| 17 | +oneof AnyValue { |
| 18 | + String string dict(AnyValueString) |
| 19 | + Bool bool |
| 20 | + Int64 int64 |
| 21 | + Float64 float64 |
| 22 | + Array []AnyValue |
| 23 | + KVList KeyValueList |
| 24 | + Bytes bytes |
16 | 25 | } |
17 | 26 |
|
18 | 27 | multimap KeyValueList { |
19 | | - key string |
| 28 | + key string |
20 | 29 | value AnyValue |
21 | 30 | } |
22 | 31 |
|
23 | 32 | struct Resource dict(Resource) { |
24 | 33 | // All SchemaURL fields use the same (shared) dict. |
25 | | - SchemaURL string dict(SchemaURL) |
26 | | - Attributes Attributes |
| 34 | + SchemaURL string dict(SchemaURL) |
| 35 | + Attributes Attributes |
27 | 36 | DroppedAttributesCount uint64 |
28 | 37 | } |
29 | 38 |
|
30 | | -// Point represents a metric data point. |
31 | | -struct Point { |
32 | | - StartTimestamp uint64 |
33 | | - Timestamp uint64 |
34 | | - Value PointValue |
35 | | - Exemplars []Exemplar |
| 39 | +struct Scope dict(Scope) { |
| 40 | + Name string dict(ScopeName) |
| 41 | + Version string dict(ScopeVersion) |
| 42 | + SchemaURL string dict(SchemaURL) |
| 43 | + Attributes Attributes |
| 44 | + DroppedAttributesCount uint64 |
36 | 45 | } |
37 | 46 |
|
38 | | -struct Span { |
39 | | - TraceID bytes |
40 | | - SpanID bytes |
41 | | - TraceState string |
42 | | - ParentSpanID bytes |
43 | | - Flags uint64 |
44 | | - Name string dict(SpanName) |
45 | | - Kind SpanKind |
46 | | - StartTimeUnixNano uint64 |
47 | | - EndTimeUnixNano uint64 |
48 | | - Attributes Attributes |
49 | | - DroppedAttributesCount uint64 |
50 | | - Events []Event |
51 | | - Links []Link |
52 | | - Status SpanStatus |
| 47 | +struct Envelope { |
| 48 | + Attributes EnvelopeAttributes |
53 | 49 | } |
54 | 50 |
|
55 | | -enum SpanKind { |
56 | | - Unspecified = 0 |
57 | | - Internal = 1 |
58 | | - Server = 2 |
59 | | - Client = 3 |
60 | | - Producer = 4 |
61 | | - Consumer = 5 |
| 51 | +multimap EnvelopeAttributes { |
| 52 | + key string |
| 53 | + value bytes |
62 | 54 | } |
63 | 55 |
|
64 | | -oneof PointValue { |
65 | | - Int64 int64 |
66 | | - Float64 float64 |
67 | | - Histogram HistogramValue |
68 | | - ExpHistogram ExpHistogramValue |
69 | | - Summary SummaryValue |
| 56 | +//////////////////////////////////////////////////////////////// |
| 57 | +// Metric signal schema. |
| 58 | +//////////////////////////////////////////////////////////////// |
| 59 | + |
| 60 | +struct Metrics root { |
| 61 | + Envelope Envelope |
| 62 | + Metric Metric |
| 63 | + Resource Resource |
| 64 | + Scope Scope |
| 65 | + Attributes Attributes |
| 66 | + Point Point |
70 | 67 | } |
71 | 68 |
|
72 | 69 | struct Metric dict(Metric) { |
73 | | - Name string dict(MetricName) |
74 | | - Description string dict(MetricDescription) |
75 | | - Unit string dict(MetricUnit) |
76 | | - Type MetricType |
77 | | - Metadata Attributes |
78 | | - HistogramBounds []float64 |
| 70 | + Name string dict(MetricName) |
| 71 | + Description string dict(MetricDescription) |
| 72 | + Unit string dict(MetricUnit) |
| 73 | + Type MetricType |
| 74 | + Metadata Attributes |
| 75 | + HistogramBounds []float64 |
79 | 76 | AggregationTemporality AggregationTemporality |
80 | | - Monotonic bool |
| 77 | + Monotonic bool |
81 | 78 | } |
82 | 79 |
|
83 | 80 | enum MetricType { |
84 | | - Gauge = 0 |
85 | | - Sum = 1 |
86 | | - Histogram = 2 |
| 81 | + Gauge = 0 |
| 82 | + Sum = 1 |
| 83 | + Histogram = 2 |
87 | 84 | ExpHistogram = 3 |
88 | | - Summary = 4 |
| 85 | + Summary = 4 |
89 | 86 | } |
90 | 87 |
|
91 | 88 | enum AggregationTemporality { |
92 | 89 | Unspecified = 0 |
93 | | - Delta = 1 |
94 | | - Cumulative = 2 |
| 90 | + Delta = 1 |
| 91 | + Cumulative = 2 |
95 | 92 | } |
96 | 93 |
|
97 | | -struct Metrics root { |
98 | | - Envelope Envelope |
99 | | - Metric Metric |
100 | | - Resource Resource |
101 | | - Scope Scope |
102 | | - Attributes Attributes |
103 | | - Point Point |
104 | | -} |
105 | | - |
106 | | -struct Scope dict(Scope) { |
107 | | - Name string dict(ScopeName) |
108 | | - Version string dict(ScopeVersion) |
109 | | - SchemaURL string dict(SchemaURL) |
110 | | - Attributes Attributes |
111 | | - DroppedAttributesCount uint64 |
| 94 | +// Point represents a metric data point. |
| 95 | +struct Point { |
| 96 | + StartTimestamp uint64 |
| 97 | + Timestamp uint64 |
| 98 | + Value PointValue |
| 99 | + Exemplars []Exemplar |
112 | 100 | } |
113 | 101 |
|
114 | | -struct Link { |
115 | | - TraceID bytes |
116 | | - SpanID bytes |
117 | | - TraceState string |
118 | | - Flags uint64 |
119 | | - Attributes Attributes |
120 | | - DroppedAttributesCount uint64 |
| 102 | +oneof PointValue { |
| 103 | + Int64 int64 |
| 104 | + Float64 float64 |
| 105 | + Histogram HistogramValue |
| 106 | + ExpHistogram ExpHistogramValue |
| 107 | + Summary SummaryValue |
121 | 108 | } |
122 | 109 |
|
123 | 110 | struct HistogramValue { |
124 | | - Count int64 |
125 | | - Sum float64 optional |
126 | | - Min float64 optional |
127 | | - Max float64 optional |
| 111 | + Count int64 |
| 112 | + Sum float64 optional |
| 113 | + Min float64 optional |
| 114 | + Max float64 optional |
128 | 115 | BucketCounts []uint64 |
129 | 116 | } |
130 | 117 |
|
131 | 118 | struct ExpHistogramValue { |
132 | | - Count uint64 |
133 | | - Sum float64 optional |
134 | | - Min float64 optional |
135 | | - Max float64 optional |
136 | | - Scale int64 |
137 | | - ZeroCount uint64 |
| 119 | + Count uint64 |
| 120 | + Sum float64 optional |
| 121 | + Min float64 optional |
| 122 | + Max float64 optional |
| 123 | + Scale int64 |
| 124 | + ZeroCount uint64 |
138 | 125 | PositiveBuckets ExpHistogramBuckets |
139 | 126 | NegativeBuckets ExpHistogramBuckets |
140 | | - ZeroThreshold float64 |
| 127 | + ZeroThreshold float64 |
141 | 128 | } |
142 | 129 |
|
143 | 130 | struct ExpHistogramBuckets { |
144 | | - Offset int64 |
| 131 | + Offset int64 |
145 | 132 | BucketCounts []uint64 |
146 | 133 | } |
147 | 134 |
|
148 | 135 | struct SummaryValue { |
149 | | - Count uint64 |
150 | | - Sum float64 |
| 136 | + Count uint64 |
| 137 | + Sum float64 |
151 | 138 | QuantileValues []QuantileValue |
152 | 139 | } |
153 | 140 |
|
154 | 141 | struct QuantileValue { |
155 | 142 | Quantile float64 |
156 | | - Value float64 |
| 143 | + Value float64 |
157 | 144 | } |
158 | 145 |
|
159 | | -oneof AnyValue { |
160 | | - String string dict(AnyValueString) |
161 | | - Bool bool |
162 | | - Int64 int64 |
163 | | - Float64 float64 |
164 | | - Array []AnyValue |
165 | | - KVList KeyValueList |
166 | | - Bytes bytes |
| 146 | +struct Exemplar { |
| 147 | + Timestamp uint64 |
| 148 | + Value ExemplarValue |
| 149 | + SpanID bytes |
| 150 | + TraceID bytes |
| 151 | + FilteredAttributes Attributes |
167 | 152 | } |
168 | 153 |
|
169 | | -struct Event { |
170 | | - Name string dict(SpanEventName) |
171 | | - TimeUnixNano uint64 |
172 | | - Attributes Attributes |
173 | | - DroppedAttributesCount uint64 |
| 154 | +oneof ExemplarValue { |
| 155 | + Int64 int64 |
| 156 | + Float64 float64 |
174 | 157 | } |
175 | 158 |
|
176 | | -struct SpanStatus { |
177 | | - Message string |
178 | | - Code uint64 |
179 | | -} |
| 159 | +//////////////////////////////////////////////////////////////// |
| 160 | +// Trace signal schema. |
| 161 | +//////////////////////////////////////////////////////////////// |
180 | 162 |
|
181 | 163 | struct Spans root { |
182 | 164 | Envelope Envelope |
183 | 165 | Resource Resource |
184 | | - Scope Scope |
185 | | - Span Span |
| 166 | + Scope Scope |
| 167 | + Span Span |
186 | 168 | } |
187 | 169 |
|
188 | | -struct Envelope { |
189 | | - Attributes EnvelopeAttributes |
| 170 | +struct Span { |
| 171 | + TraceID bytes |
| 172 | + SpanID bytes |
| 173 | + TraceState string |
| 174 | + ParentSpanID bytes |
| 175 | + Flags uint64 |
| 176 | + Name string dict(SpanName) |
| 177 | + Kind SpanKind |
| 178 | + StartTimeUnixNano uint64 |
| 179 | + EndTimeUnixNano uint64 |
| 180 | + Attributes Attributes |
| 181 | + DroppedAttributesCount uint64 |
| 182 | + Events []Event |
| 183 | + Links []Link |
| 184 | + Status SpanStatus |
190 | 185 | } |
191 | 186 |
|
192 | | -struct Exemplar { |
193 | | - Timestamp uint64 |
194 | | - Value ExemplarValue |
195 | | - SpanID bytes |
196 | | - TraceID bytes |
197 | | - FilteredAttributes Attributes |
| 187 | +enum SpanKind { |
| 188 | + Unspecified = 0 |
| 189 | + Internal = 1 |
| 190 | + Server = 2 |
| 191 | + Client = 3 |
| 192 | + Producer = 4 |
| 193 | + Consumer = 5 |
198 | 194 | } |
199 | 195 |
|
200 | | -oneof ExemplarValue { |
201 | | - Int64 int64 |
202 | | - Float64 float64 |
| 196 | +struct Link { |
| 197 | + TraceID bytes |
| 198 | + SpanID bytes |
| 199 | + TraceState string |
| 200 | + Flags uint64 |
| 201 | + Attributes Attributes |
| 202 | + DroppedAttributesCount uint64 |
| 203 | +} |
| 204 | + |
| 205 | +struct Event { |
| 206 | + Name string dict(SpanEventName) |
| 207 | + TimeUnixNano uint64 |
| 208 | + Attributes Attributes |
| 209 | + DroppedAttributesCount uint64 |
| 210 | +} |
| 211 | + |
| 212 | +struct SpanStatus { |
| 213 | + Message string |
| 214 | + Code uint64 |
203 | 215 | } |
0 commit comments