| 1 |
// Copyright The OpenTelemetry Authors |
| 2 |
// SPDX-License-Identifier: Apache-2.0 |
| 3 |
|
| 4 |
package metricdatatest // import "go.opentelemetry.io/otel/sdk/metric/metricdata/metricdatatest" |
| 5 |
|
| 6 |
import ( |
| 7 |
"encoding/json" |
| 8 |
"testing" |
| 9 |
"time" |
| 10 |
|
| 11 |
"github.com/stretchr/testify/assert" |
| 12 |
|
| 13 |
"go.opentelemetry.io/otel/attribute" |
| 14 |
"go.opentelemetry.io/otel/sdk/instrumentation" |
| 15 |
"go.opentelemetry.io/otel/sdk/metric/metricdata" |
| 16 |
"go.opentelemetry.io/otel/sdk/resource" |
| 17 |
) |
| 18 |
|
| 19 |
var ( |
| 20 |
attrA = attribute.NewSet(attribute.Bool("A", true)) |
| 21 |
attrB = attribute.NewSet(attribute.Bool("B", true)) |
| 22 |
|
| 23 |
fltrAttrA = []attribute.KeyValue{attribute.Bool("filter A", true)} |
| 24 |
fltrAttrB = []attribute.KeyValue{attribute.Bool("filter B", true)} |
| 25 |
|
| 26 |
startA = time.Now() |
| 27 |
startB = startA.Add(time.Millisecond) |
| 28 |
endA = startA.Add(time.Second) |
| 29 |
endB = startB.Add(time.Second) |
| 30 |
|
| 31 |
spanIDA = []byte{0, 0, 0, 0, 0, 0, 0, 1} |
| 32 |
spanIDB = []byte{0, 0, 0, 0, 0, 0, 0, 2} |
| 33 |
traceIDA = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1} |
| 34 |
traceIDB = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2} |
| 35 |
|
| 36 |
exemplarInt64A = metricdata.Exemplar[int64]{ |
| 37 |
FilteredAttributes: fltrAttrA, |
| 38 |
Time: endA, |
| 39 |
Value: -10, |
| 40 |
SpanID: spanIDA, |
| 41 |
TraceID: traceIDA, |
| 42 |
} |
| 43 |
exemplarFloat64A = metricdata.Exemplar[float64]{ |
| 44 |
FilteredAttributes: fltrAttrA, |
| 45 |
Time: endA, |
| 46 |
Value: -10.0, |
| 47 |
SpanID: spanIDA, |
| 48 |
TraceID: traceIDA, |
| 49 |
} |
| 50 |
exemplarInt64B = metricdata.Exemplar[int64]{ |
| 51 |
FilteredAttributes: fltrAttrB, |
| 52 |
Time: endB, |
| 53 |
Value: 12, |
| 54 |
SpanID: spanIDB, |
| 55 |
TraceID: traceIDB, |
| 56 |
} |
| 57 |
exemplarFloat64B = metricdata.Exemplar[float64]{ |
| 58 |
FilteredAttributes: fltrAttrB, |
| 59 |
Time: endB, |
| 60 |
Value: 12.0, |
| 61 |
SpanID: spanIDB, |
| 62 |
TraceID: traceIDB, |
| 63 |
} |
| 64 |
exemplarInt64C = metricdata.Exemplar[int64]{ |
| 65 |
FilteredAttributes: fltrAttrA, |
| 66 |
Time: endB, |
| 67 |
Value: -10, |
| 68 |
SpanID: spanIDA, |
| 69 |
TraceID: traceIDA, |
| 70 |
} |
| 71 |
exemplarFloat64C = metricdata.Exemplar[float64]{ |
| 72 |
FilteredAttributes: fltrAttrA, |
| 73 |
Time: endB, |
| 74 |
Value: -10.0, |
| 75 |
SpanID: spanIDA, |
| 76 |
TraceID: traceIDA, |
| 77 |
} |
| 78 |
exemplarInt64D = metricdata.Exemplar[int64]{ |
| 79 |
FilteredAttributes: fltrAttrA, |
| 80 |
Time: endA, |
| 81 |
Value: 12, |
| 82 |
SpanID: spanIDA, |
| 83 |
TraceID: traceIDA, |
| 84 |
} |
| 85 |
exemplarFloat64D = metricdata.Exemplar[float64]{ |
| 86 |
FilteredAttributes: fltrAttrA, |
| 87 |
Time: endA, |
| 88 |
Value: 12.0, |
| 89 |
SpanID: spanIDA, |
| 90 |
TraceID: traceIDA, |
| 91 |
} |
| 92 |
|
| 93 |
dataPointInt64A = metricdata.DataPoint[int64]{ |
| 94 |
Attributes: attrA, |
| 95 |
StartTime: startA, |
| 96 |
Time: endA, |
| 97 |
Value: -1, |
| 98 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 99 |
} |
| 100 |
dataPointFloat64A = metricdata.DataPoint[float64]{ |
| 101 |
Attributes: attrA, |
| 102 |
StartTime: startA, |
| 103 |
Time: endA, |
| 104 |
Value: -1.0, |
| 105 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 106 |
} |
| 107 |
dataPointInt64B = metricdata.DataPoint[int64]{ |
| 108 |
Attributes: attrB, |
| 109 |
StartTime: startB, |
| 110 |
Time: endB, |
| 111 |
Value: 2, |
| 112 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, |
| 113 |
} |
| 114 |
dataPointFloat64B = metricdata.DataPoint[float64]{ |
| 115 |
Attributes: attrB, |
| 116 |
StartTime: startB, |
| 117 |
Time: endB, |
| 118 |
Value: 2.0, |
| 119 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, |
| 120 |
} |
| 121 |
dataPointInt64C = metricdata.DataPoint[int64]{ |
| 122 |
Attributes: attrA, |
| 123 |
StartTime: startB, |
| 124 |
Time: endB, |
| 125 |
Value: -1, |
| 126 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, |
| 127 |
} |
| 128 |
dataPointFloat64C = metricdata.DataPoint[float64]{ |
| 129 |
Attributes: attrA, |
| 130 |
StartTime: startB, |
| 131 |
Time: endB, |
| 132 |
Value: -1.0, |
| 133 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, |
| 134 |
} |
| 135 |
dataPointInt64D = metricdata.DataPoint[int64]{ |
| 136 |
Attributes: attrA, |
| 137 |
StartTime: startA, |
| 138 |
Time: endA, |
| 139 |
Value: 2, |
| 140 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 141 |
} |
| 142 |
dataPointFloat64D = metricdata.DataPoint[float64]{ |
| 143 |
Attributes: attrA, |
| 144 |
StartTime: startA, |
| 145 |
Time: endA, |
| 146 |
Value: 2.0, |
| 147 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 148 |
} |
| 149 |
|
| 150 |
minFloat64A = metricdata.NewExtrema(-1.) |
| 151 |
minInt64A = metricdata.NewExtrema[int64](-1) |
| 152 |
minFloat64B, maxFloat64B = metricdata.NewExtrema(3.), metricdata.NewExtrema(99.) |
| 153 |
minInt64B, maxInt64B = metricdata.NewExtrema[int64](3), metricdata.NewExtrema[int64](99) |
| 154 |
minFloat64C = metricdata.NewExtrema(-1.) |
| 155 |
minInt64C = metricdata.NewExtrema[int64](-1) |
| 156 |
|
| 157 |
minFloat64D = metricdata.NewExtrema(-9.999999) |
| 158 |
|
| 159 |
histogramDataPointInt64A = metricdata.HistogramDataPoint[int64]{ |
| 160 |
Attributes: attrA, |
| 161 |
StartTime: startA, |
| 162 |
Time: endA, |
| 163 |
Count: 2, |
| 164 |
Bounds: []float64{0, 10}, |
| 165 |
BucketCounts: []uint64{1, 1}, |
| 166 |
Min: minInt64A, |
| 167 |
Sum: 2, |
| 168 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 169 |
} |
| 170 |
histogramDataPointFloat64A = metricdata.HistogramDataPoint[float64]{ |
| 171 |
Attributes: attrA, |
| 172 |
StartTime: startA, |
| 173 |
Time: endA, |
| 174 |
Count: 2, |
| 175 |
Bounds: []float64{0, 10}, |
| 176 |
BucketCounts: []uint64{1, 1}, |
| 177 |
Min: minFloat64A, |
| 178 |
Sum: 2, |
| 179 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 180 |
} |
| 181 |
histogramDataPointInt64B = metricdata.HistogramDataPoint[int64]{ |
| 182 |
Attributes: attrB, |
| 183 |
StartTime: startB, |
| 184 |
Time: endB, |
| 185 |
Count: 3, |
| 186 |
Bounds: []float64{0, 10, 100}, |
| 187 |
BucketCounts: []uint64{1, 1, 1}, |
| 188 |
Max: maxInt64B, |
| 189 |
Min: minInt64B, |
| 190 |
Sum: 3, |
| 191 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, |
| 192 |
} |
| 193 |
histogramDataPointFloat64B = metricdata.HistogramDataPoint[float64]{ |
| 194 |
Attributes: attrB, |
| 195 |
StartTime: startB, |
| 196 |
Time: endB, |
| 197 |
Count: 3, |
| 198 |
Bounds: []float64{0, 10, 100}, |
| 199 |
BucketCounts: []uint64{1, 1, 1}, |
| 200 |
Max: maxFloat64B, |
| 201 |
Min: minFloat64B, |
| 202 |
Sum: 3, |
| 203 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, |
| 204 |
} |
| 205 |
histogramDataPointInt64C = metricdata.HistogramDataPoint[int64]{ |
| 206 |
Attributes: attrA, |
| 207 |
StartTime: startB, |
| 208 |
Time: endB, |
| 209 |
Count: 2, |
| 210 |
Bounds: []float64{0, 10}, |
| 211 |
BucketCounts: []uint64{1, 1}, |
| 212 |
Min: minInt64C, |
| 213 |
Sum: 2, |
| 214 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, |
| 215 |
} |
| 216 |
histogramDataPointFloat64C = metricdata.HistogramDataPoint[float64]{ |
| 217 |
Attributes: attrA, |
| 218 |
StartTime: startB, |
| 219 |
Time: endB, |
| 220 |
Count: 2, |
| 221 |
Bounds: []float64{0, 10}, |
| 222 |
BucketCounts: []uint64{1, 1}, |
| 223 |
Min: minFloat64C, |
| 224 |
Sum: 2, |
| 225 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, |
| 226 |
} |
| 227 |
histogramDataPointInt64D = metricdata.HistogramDataPoint[int64]{ |
| 228 |
Attributes: attrA, |
| 229 |
StartTime: startA, |
| 230 |
Time: endA, |
| 231 |
Count: 3, |
| 232 |
Bounds: []float64{0, 10, 100}, |
| 233 |
BucketCounts: []uint64{1, 1, 1}, |
| 234 |
Max: maxInt64B, |
| 235 |
Min: minInt64B, |
| 236 |
Sum: 3, |
| 237 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 238 |
} |
| 239 |
histogramDataPointFloat64D = metricdata.HistogramDataPoint[float64]{ |
| 240 |
Attributes: attrA, |
| 241 |
StartTime: startA, |
| 242 |
Time: endA, |
| 243 |
Count: 3, |
| 244 |
Bounds: []float64{0, 10, 100}, |
| 245 |
BucketCounts: []uint64{1, 1, 1}, |
| 246 |
Max: maxFloat64B, |
| 247 |
Min: minFloat64B, |
| 248 |
Sum: 3, |
| 249 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 250 |
} |
| 251 |
|
| 252 |
quantileValueA = metricdata.QuantileValue{ |
| 253 |
Quantile: 0.0, |
| 254 |
Value: 0.1, |
| 255 |
} |
| 256 |
quantileValueB = metricdata.QuantileValue{ |
| 257 |
Quantile: 0.1, |
| 258 |
Value: 0.2, |
| 259 |
} |
| 260 |
summaryDataPointA = metricdata.SummaryDataPoint{ |
| 261 |
Attributes: attrA, |
| 262 |
StartTime: startA, |
| 263 |
Time: endA, |
| 264 |
Count: 2, |
| 265 |
Sum: 3, |
| 266 |
QuantileValues: []metricdata.QuantileValue{quantileValueA}, |
| 267 |
} |
| 268 |
summaryDataPointB = metricdata.SummaryDataPoint{ |
| 269 |
Attributes: attrB, |
| 270 |
StartTime: startB, |
| 271 |
Time: endB, |
| 272 |
Count: 3, |
| 273 |
QuantileValues: []metricdata.QuantileValue{quantileValueB}, |
| 274 |
} |
| 275 |
summaryDataPointC = metricdata.SummaryDataPoint{ |
| 276 |
Attributes: attrA, |
| 277 |
StartTime: startB, |
| 278 |
Time: endB, |
| 279 |
Count: 2, |
| 280 |
Sum: 3, |
| 281 |
QuantileValues: []metricdata.QuantileValue{quantileValueA}, |
| 282 |
} |
| 283 |
summaryDataPointD = metricdata.SummaryDataPoint{ |
| 284 |
Attributes: attrA, |
| 285 |
StartTime: startA, |
| 286 |
Time: endA, |
| 287 |
Count: 3, |
| 288 |
QuantileValues: []metricdata.QuantileValue{quantileValueB}, |
| 289 |
} |
| 290 |
|
| 291 |
exponentialBucket2 = metricdata.ExponentialBucket{ |
| 292 |
Offset: 2, |
| 293 |
Counts: []uint64{1, 1}, |
| 294 |
} |
| 295 |
exponentialBucket3 = metricdata.ExponentialBucket{ |
| 296 |
Offset: 3, |
| 297 |
Counts: []uint64{1, 1}, |
| 298 |
} |
| 299 |
exponentialBucket4 = metricdata.ExponentialBucket{ |
| 300 |
Offset: 4, |
| 301 |
Counts: []uint64{1, 1, 1}, |
| 302 |
} |
| 303 |
exponentialBucket5 = metricdata.ExponentialBucket{ |
| 304 |
Offset: 5, |
| 305 |
Counts: []uint64{1, 1, 1}, |
| 306 |
} |
| 307 |
exponentialHistogramDataPointInt64A = metricdata.ExponentialHistogramDataPoint[int64]{ |
| 308 |
Attributes: attrA, |
| 309 |
StartTime: startA, |
| 310 |
Time: endA, |
| 311 |
Count: 5, |
| 312 |
Min: minInt64A, |
| 313 |
Sum: 2, |
| 314 |
Scale: 1, |
| 315 |
ZeroCount: 1, |
| 316 |
PositiveBucket: exponentialBucket3, |
| 317 |
NegativeBucket: exponentialBucket2, |
| 318 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 319 |
} |
| 320 |
exponentialHistogramDataPointFloat64A = metricdata.ExponentialHistogramDataPoint[float64]{ |
| 321 |
Attributes: attrA, |
| 322 |
StartTime: startA, |
| 323 |
Time: endA, |
| 324 |
Count: 5, |
| 325 |
Min: minFloat64A, |
| 326 |
Sum: 2, |
| 327 |
Scale: 1, |
| 328 |
ZeroCount: 1, |
| 329 |
PositiveBucket: exponentialBucket3, |
| 330 |
NegativeBucket: exponentialBucket2, |
| 331 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 332 |
} |
| 333 |
exponentialHistogramDataPointInt64B = metricdata.ExponentialHistogramDataPoint[int64]{ |
| 334 |
Attributes: attrB, |
| 335 |
StartTime: startB, |
| 336 |
Time: endB, |
| 337 |
Count: 6, |
| 338 |
Min: minInt64B, |
| 339 |
Max: maxInt64B, |
| 340 |
Sum: 3, |
| 341 |
Scale: 2, |
| 342 |
ZeroCount: 3, |
| 343 |
PositiveBucket: exponentialBucket4, |
| 344 |
NegativeBucket: exponentialBucket5, |
| 345 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64B}, |
| 346 |
} |
| 347 |
exponentialHistogramDataPointFloat64B = metricdata.ExponentialHistogramDataPoint[float64]{ |
| 348 |
Attributes: attrB, |
| 349 |
StartTime: startB, |
| 350 |
Time: endB, |
| 351 |
Count: 6, |
| 352 |
Min: minFloat64B, |
| 353 |
Max: maxFloat64B, |
| 354 |
Sum: 3, |
| 355 |
Scale: 2, |
| 356 |
ZeroCount: 3, |
| 357 |
PositiveBucket: exponentialBucket4, |
| 358 |
NegativeBucket: exponentialBucket5, |
| 359 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64B}, |
| 360 |
} |
| 361 |
exponentialHistogramDataPointInt64C = metricdata.ExponentialHistogramDataPoint[int64]{ |
| 362 |
Attributes: attrA, |
| 363 |
StartTime: startB, |
| 364 |
Time: endB, |
| 365 |
Count: 5, |
| 366 |
Min: minInt64C, |
| 367 |
Sum: 2, |
| 368 |
Scale: 1, |
| 369 |
ZeroCount: 1, |
| 370 |
PositiveBucket: exponentialBucket3, |
| 371 |
NegativeBucket: exponentialBucket2, |
| 372 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64C}, |
| 373 |
} |
| 374 |
exponentialHistogramDataPointFloat64C = metricdata.ExponentialHistogramDataPoint[float64]{ |
| 375 |
Attributes: attrA, |
| 376 |
StartTime: startB, |
| 377 |
Time: endB, |
| 378 |
Count: 5, |
| 379 |
Min: minFloat64A, |
| 380 |
Sum: 2, |
| 381 |
Scale: 1, |
| 382 |
ZeroCount: 1, |
| 383 |
PositiveBucket: exponentialBucket3, |
| 384 |
NegativeBucket: exponentialBucket2, |
| 385 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64C}, |
| 386 |
} |
| 387 |
exponentialHistogramDataPointInt64D = metricdata.ExponentialHistogramDataPoint[int64]{ |
| 388 |
Attributes: attrA, |
| 389 |
StartTime: startA, |
| 390 |
Time: endA, |
| 391 |
Count: 6, |
| 392 |
Min: minInt64B, |
| 393 |
Max: maxInt64B, |
| 394 |
Sum: 3, |
| 395 |
Scale: 2, |
| 396 |
ZeroCount: 3, |
| 397 |
PositiveBucket: exponentialBucket4, |
| 398 |
NegativeBucket: exponentialBucket5, |
| 399 |
Exemplars: []metricdata.Exemplar[int64]{exemplarInt64A}, |
| 400 |
} |
| 401 |
exponentialHistogramDataPointFloat64D = metricdata.ExponentialHistogramDataPoint[float64]{ |
| 402 |
Attributes: attrA, |
| 403 |
StartTime: startA, |
| 404 |
Time: endA, |
| 405 |
Count: 6, |
| 406 |
Min: minFloat64B, |
| 407 |
Max: maxFloat64B, |
| 408 |
Sum: 3, |
| 409 |
Scale: 2, |
| 410 |
ZeroCount: 3, |
| 411 |
PositiveBucket: exponentialBucket4, |
| 412 |
NegativeBucket: exponentialBucket5, |
| 413 |
Exemplars: []metricdata.Exemplar[float64]{exemplarFloat64A}, |
| 414 |
} |
| 415 |
|
| 416 |
gaugeInt64A = metricdata.Gauge[int64]{ |
| 417 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, |
| 418 |
} |
| 419 |
gaugeFloat64A = metricdata.Gauge[float64]{ |
| 420 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64A}, |
| 421 |
} |
| 422 |
gaugeInt64B = metricdata.Gauge[int64]{ |
| 423 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64B}, |
| 424 |
} |
| 425 |
gaugeFloat64B = metricdata.Gauge[float64]{ |
| 426 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64B}, |
| 427 |
} |
| 428 |
gaugeInt64C = metricdata.Gauge[int64]{ |
| 429 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64C}, |
| 430 |
} |
| 431 |
gaugeFloat64C = metricdata.Gauge[float64]{ |
| 432 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, |
| 433 |
} |
| 434 |
gaugeInt64D = metricdata.Gauge[int64]{ |
| 435 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64D}, |
| 436 |
} |
| 437 |
gaugeFloat64D = metricdata.Gauge[float64]{ |
| 438 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64D}, |
| 439 |
} |
| 440 |
|
| 441 |
sumInt64A = metricdata.Sum[int64]{ |
| 442 |
Temporality: metricdata.CumulativeTemporality, |
| 443 |
IsMonotonic: true, |
| 444 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64A}, |
| 445 |
} |
| 446 |
sumFloat64A = metricdata.Sum[float64]{ |
| 447 |
Temporality: metricdata.CumulativeTemporality, |
| 448 |
IsMonotonic: true, |
| 449 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64A}, |
| 450 |
} |
| 451 |
sumInt64B = metricdata.Sum[int64]{ |
| 452 |
Temporality: metricdata.CumulativeTemporality, |
| 453 |
IsMonotonic: true, |
| 454 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64B}, |
| 455 |
} |
| 456 |
sumFloat64B = metricdata.Sum[float64]{ |
| 457 |
Temporality: metricdata.CumulativeTemporality, |
| 458 |
IsMonotonic: true, |
| 459 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64B}, |
| 460 |
} |
| 461 |
sumInt64C = metricdata.Sum[int64]{ |
| 462 |
Temporality: metricdata.CumulativeTemporality, |
| 463 |
IsMonotonic: true, |
| 464 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64C}, |
| 465 |
} |
| 466 |
sumFloat64C = metricdata.Sum[float64]{ |
| 467 |
Temporality: metricdata.CumulativeTemporality, |
| 468 |
IsMonotonic: true, |
| 469 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64C}, |
| 470 |
} |
| 471 |
sumInt64D = metricdata.Sum[int64]{ |
| 472 |
Temporality: metricdata.CumulativeTemporality, |
| 473 |
IsMonotonic: true, |
| 474 |
DataPoints: []metricdata.DataPoint[int64]{dataPointInt64D}, |
| 475 |
} |
| 476 |
sumFloat64D = metricdata.Sum[float64]{ |
| 477 |
Temporality: metricdata.CumulativeTemporality, |
| 478 |
IsMonotonic: true, |
| 479 |
DataPoints: []metricdata.DataPoint[float64]{dataPointFloat64D}, |
| 480 |
} |
| 481 |
|
| 482 |
histogramInt64A = metricdata.Histogram[int64]{ |
| 483 |
Temporality: metricdata.CumulativeTemporality, |
| 484 |
DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64A}, |
| 485 |
} |
| 486 |
histogramFloat64A = metricdata.Histogram[float64]{ |
| 487 |
Temporality: metricdata.CumulativeTemporality, |
| 488 |
DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64A}, |
| 489 |
} |
| 490 |
histogramInt64B = metricdata.Histogram[int64]{ |
| 491 |
Temporality: metricdata.DeltaTemporality, |
| 492 |
DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64B}, |
| 493 |
} |
| 494 |
histogramFloat64B = metricdata.Histogram[float64]{ |
| 495 |
Temporality: metricdata.DeltaTemporality, |
| 496 |
DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64B}, |
| 497 |
} |
| 498 |
histogramInt64C = metricdata.Histogram[int64]{ |
| 499 |
Temporality: metricdata.CumulativeTemporality, |
| 500 |
DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64C}, |
| 501 |
} |
| 502 |
histogramFloat64C = metricdata.Histogram[float64]{ |
| 503 |
Temporality: metricdata.CumulativeTemporality, |
| 504 |
DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64C}, |
| 505 |
} |
| 506 |
histogramInt64D = metricdata.Histogram[int64]{ |
| 507 |
Temporality: metricdata.CumulativeTemporality, |
| 508 |
DataPoints: []metricdata.HistogramDataPoint[int64]{histogramDataPointInt64D}, |
| 509 |
} |
| 510 |
histogramFloat64D = metricdata.Histogram[float64]{ |
| 511 |
Temporality: metricdata.CumulativeTemporality, |
| 512 |
DataPoints: []metricdata.HistogramDataPoint[float64]{histogramDataPointFloat64D}, |
| 513 |
} |
| 514 |
|
| 515 |
exponentialHistogramInt64A = metricdata.ExponentialHistogram[int64]{ |
| 516 |
Temporality: metricdata.CumulativeTemporality, |
| 517 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64A}, |
| 518 |
} |
| 519 |
exponentialHistogramFloat64A = metricdata.ExponentialHistogram[float64]{ |
| 520 |
Temporality: metricdata.CumulativeTemporality, |
| 521 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64A}, |
| 522 |
} |
| 523 |
exponentialHistogramInt64B = metricdata.ExponentialHistogram[int64]{ |
| 524 |
Temporality: metricdata.DeltaTemporality, |
| 525 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64B}, |
| 526 |
} |
| 527 |
exponentialHistogramFloat64B = metricdata.ExponentialHistogram[float64]{ |
| 528 |
Temporality: metricdata.DeltaTemporality, |
| 529 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64B}, |
| 530 |
} |
| 531 |
exponentialHistogramInt64C = metricdata.ExponentialHistogram[int64]{ |
| 532 |
Temporality: metricdata.CumulativeTemporality, |
| 533 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64C}, |
| 534 |
} |
| 535 |
exponentialHistogramFloat64C = metricdata.ExponentialHistogram[float64]{ |
| 536 |
Temporality: metricdata.CumulativeTemporality, |
| 537 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64C}, |
| 538 |
} |
| 539 |
exponentialHistogramInt64D = metricdata.ExponentialHistogram[int64]{ |
| 540 |
Temporality: metricdata.CumulativeTemporality, |
| 541 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[int64]{exponentialHistogramDataPointInt64D}, |
| 542 |
} |
| 543 |
exponentialHistogramFloat64D = metricdata.ExponentialHistogram[float64]{ |
| 544 |
Temporality: metricdata.CumulativeTemporality, |
| 545 |
DataPoints: []metricdata.ExponentialHistogramDataPoint[float64]{exponentialHistogramDataPointFloat64D}, |
| 546 |
} |
| 547 |
|
| 548 |
summaryA = metricdata.Summary{ |
| 549 |
DataPoints: []metricdata.SummaryDataPoint{summaryDataPointA}, |
| 550 |
} |
| 551 |
|
| 552 |
summaryB = metricdata.Summary{ |
| 553 |
DataPoints: []metricdata.SummaryDataPoint{summaryDataPointB}, |
| 554 |
} |
| 555 |
|
| 556 |
summaryC = metricdata.Summary{ |
| 557 |
DataPoints: []metricdata.SummaryDataPoint{summaryDataPointC}, |
| 558 |
} |
| 559 |
|
| 560 |
summaryD = metricdata.Summary{ |
| 561 |
DataPoints: []metricdata.SummaryDataPoint{summaryDataPointD}, |
| 562 |
} |
| 563 |
|
| 564 |
metricsA = metricdata.Metrics{ |
| 565 |
Name: "A", |
| 566 |
Description: "A desc", |
| 567 |
Unit: "1", |
| 568 |
Data: sumInt64A, |
| 569 |
} |
| 570 |
metricsB = metricdata.Metrics{ |
| 571 |
Name: "B", |
| 572 |
Description: "B desc", |
| 573 |
Unit: "By", |
| 574 |
Data: gaugeFloat64B, |
| 575 |
} |
| 576 |
metricsC = metricdata.Metrics{ |
| 577 |
Name: "A", |
| 578 |
Description: "A desc", |
| 579 |
Unit: "1", |
| 580 |
Data: sumInt64C, |
| 581 |
} |
| 582 |
metricsD = metricdata.Metrics{ |
| 583 |
Name: "A", |
| 584 |
Description: "A desc", |
| 585 |
Unit: "1", |
| 586 |
Data: sumInt64D, |
| 587 |
} |
| 588 |
|
| 589 |
scopeMetricsA = metricdata.ScopeMetrics{ |
| 590 |
Scope: instrumentation.Scope{Name: "A"}, |
| 591 |
Metrics: []metricdata.Metrics{metricsA}, |
| 592 |
} |
| 593 |
scopeMetricsB = metricdata.ScopeMetrics{ |
| 594 |
Scope: instrumentation.Scope{Name: "B"}, |
| 595 |
Metrics: []metricdata.Metrics{metricsB}, |
| 596 |
} |
| 597 |
scopeMetricsC = metricdata.ScopeMetrics{ |
| 598 |
Scope: instrumentation.Scope{Name: "A"}, |
| 599 |
Metrics: []metricdata.Metrics{metricsC}, |
| 600 |
} |
| 601 |
scopeMetricsD = metricdata.ScopeMetrics{ |
| 602 |
Scope: instrumentation.Scope{Name: "A"}, |
| 603 |
Metrics: []metricdata.Metrics{metricsD}, |
| 604 |
} |
| 605 |
|
| 606 |
resourceMetricsA = metricdata.ResourceMetrics{ |
| 607 |
Resource: resource.NewSchemaless(attribute.String("resource", "A")), |
| 608 |
ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsA}, |
| 609 |
} |
| 610 |
resourceMetricsB = metricdata.ResourceMetrics{ |
| 611 |
Resource: resource.NewSchemaless(attribute.String("resource", "B")), |
| 612 |
ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsB}, |
| 613 |
} |
| 614 |
resourceMetricsC = metricdata.ResourceMetrics{ |
| 615 |
Resource: resource.NewSchemaless(attribute.String("resource", "A")), |
| 616 |
ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsC}, |
| 617 |
} |
| 618 |
resourceMetricsD = metricdata.ResourceMetrics{ |
| 619 |
Resource: resource.NewSchemaless(attribute.String("resource", "A")), |
| 620 |
ScopeMetrics: []metricdata.ScopeMetrics{scopeMetricsD}, |
| 621 |
} |
| 622 |
) |
| 623 |
|
| 624 |
type equalFunc[T Datatypes] func(T, T, config) []string |
| 625 |
|
| 626 |
func testDatatype[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { |
| 627 |
return func(t *testing.T) { |
| 628 |
AssertEqual(t, a, a) |
| 629 |
AssertEqual(t, b, b) |
| 630 |
|
| 631 |
r := f(a, b, newConfig(nil)) |
| 632 |
assert.NotEmptyf(t, r, "%v == %v", a, b) |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
func testDatatypeIgnoreTime[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { |
| 637 |
return func(t *testing.T) { |
| 638 |
AssertEqual(t, a, a) |
| 639 |
AssertEqual(t, b, b) |
| 640 |
|
| 641 |
c := newConfig([]Option{IgnoreTimestamp()}) |
| 642 |
r := f(a, b, c) |
| 643 |
assert.Empty(t, r, "unexpected inequality") |
| 644 |
} |
| 645 |
} |
| 646 |
|
| 647 |
func testDatatypeIgnoreExemplars[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { |
| 648 |
return func(t *testing.T) { |
| 649 |
AssertEqual(t, a, a) |
| 650 |
AssertEqual(t, b, b) |
| 651 |
|
| 652 |
c := newConfig([]Option{IgnoreExemplars()}) |
| 653 |
r := f(a, b, c) |
| 654 |
assert.Empty(t, r, "unexpected inequality") |
| 655 |
} |
| 656 |
} |
| 657 |
|
| 658 |
func testDatatypeIgnoreValue[T Datatypes](a, b T, f equalFunc[T]) func(*testing.T) { |
| 659 |
return func(t *testing.T) { |
| 660 |
AssertEqual(t, a, a) |
| 661 |
AssertEqual(t, b, b) |
| 662 |
|
| 663 |
c := newConfig([]Option{IgnoreValue()}) |
| 664 |
r := f(a, b, c) |
| 665 |
assert.Empty(t, r, "unexpected inequality") |
| 666 |
} |
| 667 |
} |
| 668 |
|
| 669 |
func TestTestingTImplementation(t *testing.T) { |
| 670 |
assert.Implements(t, (*TestingT)(nil), t) |
| 671 |
} |
| 672 |
|
| 673 |
func TestAssertEqual(t *testing.T) { |
| 674 |
t.Run("ResourceMetrics", testDatatype(resourceMetricsA, resourceMetricsB, equalResourceMetrics)) |
| 675 |
t.Run("ScopeMetrics", testDatatype(scopeMetricsA, scopeMetricsB, equalScopeMetrics)) |
| 676 |
t.Run("Metrics", testDatatype(metricsA, metricsB, equalMetrics)) |
| 677 |
t.Run("HistogramInt64", testDatatype(histogramInt64A, histogramInt64B, equalHistograms[int64])) |
| 678 |
t.Run("HistogramFloat64", testDatatype(histogramFloat64A, histogramFloat64B, equalHistograms[float64])) |
| 679 |
t.Run("SumInt64", testDatatype(sumInt64A, sumInt64B, equalSums[int64])) |
| 680 |
t.Run("SumFloat64", testDatatype(sumFloat64A, sumFloat64B, equalSums[float64])) |
| 681 |
t.Run("GaugeInt64", testDatatype(gaugeInt64A, gaugeInt64B, equalGauges[int64])) |
| 682 |
t.Run("GaugeFloat64", testDatatype(gaugeFloat64A, gaugeFloat64B, equalGauges[float64])) |
| 683 |
t.Run( |
| 684 |
"HistogramDataPointInt64", |
| 685 |
testDatatype(histogramDataPointInt64A, histogramDataPointInt64B, equalHistogramDataPoints[int64]), |
| 686 |
) |
| 687 |
t.Run( |
| 688 |
"HistogramDataPointFloat64", |
| 689 |
testDatatype(histogramDataPointFloat64A, histogramDataPointFloat64B, equalHistogramDataPoints[float64]), |
| 690 |
) |
| 691 |
t.Run("DataPointInt64", testDatatype(dataPointInt64A, dataPointInt64B, equalDataPoints[int64])) |
| 692 |
t.Run("DataPointFloat64", testDatatype(dataPointFloat64A, dataPointFloat64B, equalDataPoints[float64])) |
| 693 |
t.Run("ExtremaInt64", testDatatype(minInt64A, minInt64B, equalExtrema[int64])) |
| 694 |
t.Run("ExtremaFloat64", testDatatype(minFloat64A, minFloat64B, equalExtrema[float64])) |
| 695 |
t.Run("ExemplarInt64", testDatatype(exemplarInt64A, exemplarInt64B, equalExemplars[int64])) |
| 696 |
t.Run("ExemplarFloat64", testDatatype(exemplarFloat64A, exemplarFloat64B, equalExemplars[float64])) |
| 697 |
t.Run( |
| 698 |
"ExponentialHistogramInt64", |
| 699 |
testDatatype(exponentialHistogramInt64A, exponentialHistogramInt64B, equalExponentialHistograms[int64]), |
| 700 |
) |
| 701 |
t.Run( |
| 702 |
"ExponentialHistogramFloat64", |
| 703 |
testDatatype(exponentialHistogramFloat64A, exponentialHistogramFloat64B, equalExponentialHistograms[float64]), |
| 704 |
) |
| 705 |
t.Run( |
| 706 |
"ExponentialHistogramDataPointInt64", |
| 707 |
testDatatype( |
| 708 |
exponentialHistogramDataPointInt64A, |
| 709 |
exponentialHistogramDataPointInt64B, |
| 710 |
equalExponentialHistogramDataPoints[int64], |
| 711 |
), |
| 712 |
) |
| 713 |
t.Run( |
| 714 |
"ExponentialHistogramDataPointFloat64", |
| 715 |
testDatatype( |
| 716 |
exponentialHistogramDataPointFloat64A, |
| 717 |
exponentialHistogramDataPointFloat64B, |
| 718 |
equalExponentialHistogramDataPoints[float64], |
| 719 |
), |
| 720 |
) |
| 721 |
t.Run("ExponentialBuckets", testDatatype(exponentialBucket2, exponentialBucket3, equalExponentialBuckets)) |
| 722 |
t.Run("Summary", testDatatype(summaryA, summaryB, equalSummary)) |
| 723 |
t.Run("SummaryDataPoint", testDatatype(summaryDataPointA, summaryDataPointB, equalSummaryDataPoint)) |
| 724 |
t.Run("QuantileValues", testDatatype(quantileValueA, quantileValueB, equalQuantileValue)) |
| 725 |
} |
| 726 |
|
| 727 |
func TestAssertEqualIgnoreTime(t *testing.T) { |
| 728 |
t.Run("ResourceMetrics", testDatatypeIgnoreTime(resourceMetricsA, resourceMetricsC, equalResourceMetrics)) |
| 729 |
t.Run("ScopeMetrics", testDatatypeIgnoreTime(scopeMetricsA, scopeMetricsC, equalScopeMetrics)) |
| 730 |
t.Run("Metrics", testDatatypeIgnoreTime(metricsA, metricsC, equalMetrics)) |
| 731 |
t.Run("HistogramInt64", testDatatypeIgnoreTime(histogramInt64A, histogramInt64C, equalHistograms[int64])) |
| 732 |
t.Run("HistogramFloat64", testDatatypeIgnoreTime(histogramFloat64A, histogramFloat64C, equalHistograms[float64])) |
| 733 |
t.Run("SumInt64", testDatatypeIgnoreTime(sumInt64A, sumInt64C, equalSums[int64])) |
| 734 |
t.Run("SumFloat64", testDatatypeIgnoreTime(sumFloat64A, sumFloat64C, equalSums[float64])) |
| 735 |
t.Run("GaugeInt64", testDatatypeIgnoreTime(gaugeInt64A, gaugeInt64C, equalGauges[int64])) |
| 736 |
t.Run("GaugeFloat64", testDatatypeIgnoreTime(gaugeFloat64A, gaugeFloat64C, equalGauges[float64])) |
| 737 |
t.Run( |
| 738 |
"HistogramDataPointInt64", |
| 739 |
testDatatypeIgnoreTime(histogramDataPointInt64A, histogramDataPointInt64C, equalHistogramDataPoints[int64]), |
| 740 |
) |
| 741 |
t.Run( |
| 742 |
"HistogramDataPointFloat64", |
| 743 |
testDatatypeIgnoreTime( |
| 744 |
histogramDataPointFloat64A, |
| 745 |
histogramDataPointFloat64C, |
| 746 |
equalHistogramDataPoints[float64], |
| 747 |
), |
| 748 |
) |
| 749 |
t.Run("DataPointInt64", testDatatypeIgnoreTime(dataPointInt64A, dataPointInt64C, equalDataPoints[int64])) |
| 750 |
t.Run("DataPointFloat64", testDatatypeIgnoreTime(dataPointFloat64A, dataPointFloat64C, equalDataPoints[float64])) |
| 751 |
t.Run("ExtremaInt64", testDatatypeIgnoreTime(minInt64A, minInt64C, equalExtrema[int64])) |
| 752 |
t.Run("ExtremaFloat64", testDatatypeIgnoreTime(minFloat64A, minFloat64C, equalExtrema[float64])) |
| 753 |
t.Run("ExemplarInt64", testDatatypeIgnoreTime(exemplarInt64A, exemplarInt64C, equalExemplars[int64])) |
| 754 |
t.Run("ExemplarFloat64", testDatatypeIgnoreTime(exemplarFloat64A, exemplarFloat64C, equalExemplars[float64])) |
| 755 |
t.Run( |
| 756 |
"ExponentialHistogramInt64", |
| 757 |
testDatatypeIgnoreTime( |
| 758 |
exponentialHistogramInt64A, |
| 759 |
exponentialHistogramInt64C, |
| 760 |
equalExponentialHistograms[int64], |
| 761 |
), |
| 762 |
) |
| 763 |
t.Run( |
| 764 |
"ExponentialHistogramFloat64", |
| 765 |
testDatatypeIgnoreTime( |
| 766 |
exponentialHistogramFloat64A, |
| 767 |
exponentialHistogramFloat64C, |
| 768 |
equalExponentialHistograms[float64], |
| 769 |
), |
| 770 |
) |
| 771 |
t.Run( |
| 772 |
"ExponentialHistogramDataPointInt64", |
| 773 |
testDatatypeIgnoreTime( |
| 774 |
exponentialHistogramDataPointInt64A, |
| 775 |
exponentialHistogramDataPointInt64C, |
| 776 |
equalExponentialHistogramDataPoints[int64], |
| 777 |
), |
| 778 |
) |
| 779 |
t.Run( |
| 780 |
"ExponentialHistogramDataPointFloat64", |
| 781 |
testDatatypeIgnoreTime( |
| 782 |
exponentialHistogramDataPointFloat64A, |
| 783 |
exponentialHistogramDataPointFloat64C, |
| 784 |
equalExponentialHistogramDataPoints[float64], |
| 785 |
), |
| 786 |
) |
| 787 |
t.Run("Summary", testDatatypeIgnoreTime(summaryA, summaryC, equalSummary)) |
| 788 |
t.Run("SummaryDataPoint", testDatatypeIgnoreTime(summaryDataPointA, summaryDataPointC, equalSummaryDataPoint)) |
| 789 |
} |
| 790 |
|
| 791 |
func TestAssertEqualIgnoreExemplars(t *testing.T) { |
| 792 |
hdpInt64 := histogramDataPointInt64A |
| 793 |
hdpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} |
| 794 |
t.Run( |
| 795 |
"HistogramDataPointInt64", |
| 796 |
testDatatypeIgnoreExemplars(histogramDataPointInt64A, hdpInt64, equalHistogramDataPoints[int64]), |
| 797 |
) |
| 798 |
|
| 799 |
hdpFloat64 := histogramDataPointFloat64A |
| 800 |
hdpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} |
| 801 |
t.Run( |
| 802 |
"HistogramDataPointFloat64", |
| 803 |
testDatatypeIgnoreExemplars(histogramDataPointFloat64A, hdpFloat64, equalHistogramDataPoints[float64]), |
| 804 |
) |
| 805 |
|
| 806 |
dpInt64 := dataPointInt64A |
| 807 |
dpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} |
| 808 |
t.Run("DataPointInt64", testDatatypeIgnoreExemplars(dataPointInt64A, dpInt64, equalDataPoints[int64])) |
| 809 |
|
| 810 |
dpFloat64 := dataPointFloat64A |
| 811 |
dpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} |
| 812 |
t.Run("DataPointFloat64", testDatatypeIgnoreExemplars(dataPointFloat64A, dpFloat64, equalDataPoints[float64])) |
| 813 |
|
| 814 |
ehdpInt64 := exponentialHistogramDataPointInt64A |
| 815 |
ehdpInt64.Exemplars = []metricdata.Exemplar[int64]{exemplarInt64B} |
| 816 |
t.Run( |
| 817 |
"ExponentialHistogramDataPointInt64", |
| 818 |
testDatatypeIgnoreExemplars( |
| 819 |
exponentialHistogramDataPointInt64A, |
| 820 |
ehdpInt64, |
| 821 |
equalExponentialHistogramDataPoints[int64], |
| 822 |
), |
| 823 |
) |
| 824 |
|
| 825 |
ehdpFloat64 := exponentialHistogramDataPointFloat64A |
| 826 |
ehdpFloat64.Exemplars = []metricdata.Exemplar[float64]{exemplarFloat64B} |
| 827 |
t.Run( |
| 828 |
"ExponentialHistogramDataPointFloat64", |
| 829 |
testDatatypeIgnoreExemplars( |
| 830 |
exponentialHistogramDataPointFloat64A, |
| 831 |
ehdpFloat64, |
| 832 |
equalExponentialHistogramDataPoints[float64], |
| 833 |
), |
| 834 |
) |
| 835 |
} |
| 836 |
|
| 837 |
func TestAssertEqualIgnoreValue(t *testing.T) { |
| 838 |
t.Run("ResourceMetrics", testDatatypeIgnoreValue(resourceMetricsA, resourceMetricsD, equalResourceMetrics)) |
| 839 |
t.Run("ScopeMetrics", testDatatypeIgnoreValue(scopeMetricsA, scopeMetricsD, equalScopeMetrics)) |
| 840 |
t.Run("Metrics", testDatatypeIgnoreValue(metricsA, metricsD, equalMetrics)) |
| 841 |
t.Run("HistogramInt64", testDatatypeIgnoreValue(histogramInt64A, histogramInt64D, equalHistograms[int64])) |
| 842 |
t.Run("HistogramFloat64", testDatatypeIgnoreValue(histogramFloat64A, histogramFloat64D, equalHistograms[float64])) |
| 843 |
t.Run("SumInt64", testDatatypeIgnoreValue(sumInt64A, sumInt64D, equalSums[int64])) |
| 844 |
t.Run("SumFloat64", testDatatypeIgnoreValue(sumFloat64A, sumFloat64D, equalSums[float64])) |
| 845 |
t.Run("GaugeInt64", testDatatypeIgnoreValue(gaugeInt64A, gaugeInt64D, equalGauges[int64])) |
| 846 |
t.Run("GaugeFloat64", testDatatypeIgnoreValue(gaugeFloat64A, gaugeFloat64D, equalGauges[float64])) |
| 847 |
t.Run( |
| 848 |
"HistogramDataPointInt64", |
| 849 |
testDatatypeIgnoreValue(histogramDataPointInt64A, histogramDataPointInt64D, equalHistogramDataPoints[int64]), |
| 850 |
) |
| 851 |
t.Run( |
| 852 |
"HistogramDataPointFloat64", |
| 853 |
testDatatypeIgnoreValue( |
| 854 |
histogramDataPointFloat64A, |
| 855 |
histogramDataPointFloat64D, |
| 856 |
equalHistogramDataPoints[float64], |
| 857 |
), |
| 858 |
) |
| 859 |
t.Run("DataPointInt64", testDatatypeIgnoreValue(dataPointInt64A, dataPointInt64D, equalDataPoints[int64])) |
| 860 |
t.Run("DataPointFloat64", testDatatypeIgnoreValue(dataPointFloat64A, dataPointFloat64D, equalDataPoints[float64])) |
| 861 |
t.Run("ExemplarInt64", testDatatypeIgnoreValue(exemplarInt64A, exemplarInt64D, equalExemplars[int64])) |
| 862 |
t.Run("ExemplarFloat64", testDatatypeIgnoreValue(exemplarFloat64A, exemplarFloat64D, equalExemplars[float64])) |
| 863 |
t.Run( |
| 864 |
"ExponentialHistogramInt64", |
| 865 |
testDatatypeIgnoreValue( |
| 866 |
exponentialHistogramInt64A, |
| 867 |
exponentialHistogramInt64D, |
| 868 |
equalExponentialHistograms[int64], |
| 869 |
), |
| 870 |
) |
| 871 |
t.Run( |
| 872 |
"ExponentialHistogramFloat64", |
| 873 |
testDatatypeIgnoreValue( |
| 874 |
exponentialHistogramFloat64A, |
| 875 |
exponentialHistogramFloat64D, |
| 876 |
equalExponentialHistograms[float64], |
| 877 |
), |
| 878 |
) |
| 879 |
t.Run( |
| 880 |
"ExponentialHistogramDataPointInt64", |
| 881 |
testDatatypeIgnoreValue( |
| 882 |
exponentialHistogramDataPointInt64A, |
| 883 |
exponentialHistogramDataPointInt64D, |
| 884 |
equalExponentialHistogramDataPoints[int64], |
| 885 |
), |
| 886 |
) |
| 887 |
t.Run( |
| 888 |
"ExponentialHistogramDataPointFloat64", |
| 889 |
testDatatypeIgnoreValue( |
| 890 |
exponentialHistogramDataPointFloat64A, |
| 891 |
exponentialHistogramDataPointFloat64D, |
| 892 |
equalExponentialHistogramDataPoints[float64], |
| 893 |
), |
| 894 |
) |
| 895 |
t.Run("Summary", testDatatypeIgnoreValue(summaryA, summaryD, equalSummary)) |
| 896 |
t.Run("SummaryDataPoint", testDatatypeIgnoreValue(summaryDataPointA, summaryDataPointD, equalSummaryDataPoint)) |
| 897 |
} |
| 898 |
|
| 899 |
type unknownAggregation struct { |
| 900 |
metricdata.Aggregation |
| 901 |
} |
| 902 |
|
| 903 |
func TestAssertAggregationsEqual(t *testing.T) { |
| 904 |
AssertAggregationsEqual(t, nil, nil) |
| 905 |
AssertAggregationsEqual(t, sumInt64A, sumInt64A) |
| 906 |
AssertAggregationsEqual(t, sumFloat64A, sumFloat64A) |
| 907 |
AssertAggregationsEqual(t, gaugeInt64A, gaugeInt64A) |
| 908 |
AssertAggregationsEqual(t, gaugeFloat64A, gaugeFloat64A) |
| 909 |
AssertAggregationsEqual(t, histogramInt64A, histogramInt64A) |
| 910 |
AssertAggregationsEqual(t, histogramFloat64A, histogramFloat64A) |
| 911 |
AssertAggregationsEqual(t, exponentialHistogramInt64A, exponentialHistogramInt64A) |
| 912 |
AssertAggregationsEqual(t, exponentialHistogramFloat64A, exponentialHistogramFloat64A) |
| 913 |
AssertAggregationsEqual(t, summaryA, summaryA) |
| 914 |
|
| 915 |
r := equalAggregations(sumInt64A, nil, config{}) |
| 916 |
assert.Len(t, r, 1, "should return nil comparison mismatch only") |
| 917 |
|
| 918 |
r = equalAggregations(sumInt64A, gaugeInt64A, config{}) |
| 919 |
assert.Len(t, r, 1, "should return with type mismatch only") |
| 920 |
|
| 921 |
r = equalAggregations(unknownAggregation{}, unknownAggregation{}, config{}) |
| 922 |
assert.Len(t, r, 1, "should return with unknown aggregation only") |
| 923 |
|
| 924 |
r = equalAggregations(sumInt64A, sumInt64B, config{}) |
| 925 |
assert.NotEmptyf(t, r, "sums should not be equal: %v == %v", sumInt64A, sumInt64B) |
| 926 |
|
| 927 |
r = equalAggregations(sumInt64A, sumInt64C, config{ignoreTimestamp: true}) |
| 928 |
assert.Empty(t, r, "sums should be equal: %v", r) |
| 929 |
|
| 930 |
r = equalAggregations(sumInt64A, sumInt64D, config{ignoreValue: true}) |
| 931 |
assert.Empty(t, r, "value should be ignored: %v == %v", sumInt64A, sumInt64D) |
| 932 |
|
| 933 |
r = equalAggregations(sumFloat64A, sumFloat64B, config{}) |
| 934 |
assert.NotEmptyf(t, r, "sums should not be equal: %v == %v", sumFloat64A, sumFloat64B) |
| 935 |
|
| 936 |
r = equalAggregations(sumFloat64A, sumFloat64C, config{ignoreTimestamp: true}) |
| 937 |
assert.Empty(t, r, "sums should be equal: %v", r) |
| 938 |
|
| 939 |
r = equalAggregations(sumFloat64A, sumFloat64D, config{ignoreValue: true}) |
| 940 |
assert.Empty(t, r, "value should be ignored: %v == %v", sumFloat64A, sumFloat64D) |
| 941 |
|
| 942 |
r = equalAggregations(gaugeInt64A, gaugeInt64B, config{}) |
| 943 |
assert.NotEmptyf(t, r, "gauges should not be equal: %v == %v", gaugeInt64A, gaugeInt64B) |
| 944 |
|
| 945 |
r = equalAggregations(gaugeInt64A, gaugeInt64C, config{ignoreTimestamp: true}) |
| 946 |
assert.Empty(t, r, "gauges should be equal: %v", r) |
| 947 |
|
| 948 |
r = equalAggregations(gaugeInt64A, gaugeInt64D, config{ignoreValue: true}) |
| 949 |
assert.Empty(t, r, "value should be ignored: %v == %v", gaugeInt64A, gaugeInt64D) |
| 950 |
|
| 951 |
r = equalAggregations(gaugeFloat64A, gaugeFloat64B, config{}) |
| 952 |
assert.NotEmptyf(t, r, "gauges should not be equal: %v == %v", gaugeFloat64A, gaugeFloat64B) |
| 953 |
|
| 954 |
r = equalAggregations(gaugeFloat64A, gaugeFloat64C, config{ignoreTimestamp: true}) |
| 955 |
assert.Empty(t, r, "gauges should be equal: %v", r) |
| 956 |
|
| 957 |
r = equalAggregations(gaugeFloat64A, gaugeFloat64D, config{ignoreValue: true}) |
| 958 |
assert.Empty(t, r, "value should be ignored: %v == %v", gaugeFloat64A, gaugeFloat64D) |
| 959 |
|
| 960 |
r = equalAggregations(histogramInt64A, histogramInt64B, config{}) |
| 961 |
assert.NotEmptyf(t, r, "histograms should not be equal: %v == %v", histogramInt64A, histogramInt64B) |
| 962 |
|
| 963 |
r = equalAggregations(histogramInt64A, histogramInt64C, config{ignoreTimestamp: true}) |
| 964 |
assert.Empty(t, r, "histograms should be equal: %v", r) |
| 965 |
|
| 966 |
r = equalAggregations(histogramInt64A, histogramInt64D, config{ignoreValue: true}) |
| 967 |
assert.Empty(t, r, "value should be ignored: %v == %v", histogramInt64A, histogramInt64D) |
| 968 |
|
| 969 |
r = equalAggregations(histogramFloat64A, histogramFloat64B, config{}) |
| 970 |
assert.NotEmptyf(t, r, "histograms should not be equal: %v == %v", histogramFloat64A, histogramFloat64B) |
| 971 |
|
| 972 |
r = equalAggregations(histogramFloat64A, histogramFloat64C, config{ignoreTimestamp: true}) |
| 973 |
assert.Empty(t, r, "histograms should be equal: %v", r) |
| 974 |
|
| 975 |
r = equalAggregations(histogramFloat64A, histogramFloat64D, config{ignoreValue: true}) |
| 976 |
assert.Empty(t, r, "value should be ignored: %v == %v", histogramFloat64A, histogramFloat64D) |
| 977 |
|
| 978 |
r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64B, config{}) |
| 979 |
assert.NotEmptyf( |
| 980 |
t, |
| 981 |
r, |
| 982 |
"exponential histograms should not be equal: %v == %v", |
| 983 |
exponentialHistogramInt64A, |
| 984 |
exponentialHistogramInt64B, |
| 985 |
) |
| 986 |
|
| 987 |
r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64C, config{ignoreTimestamp: true}) |
| 988 |
assert.Empty(t, r, "exponential histograms should be equal: %v", r) |
| 989 |
|
| 990 |
r = equalAggregations(exponentialHistogramInt64A, exponentialHistogramInt64D, config{ignoreValue: true}) |
| 991 |
assert.Empty(t, r, "value should be ignored: %v == %v", exponentialHistogramInt64A, exponentialHistogramInt64D) |
| 992 |
|
| 993 |
r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64B, config{}) |
| 994 |
assert.NotEmptyf( |
| 995 |
t, |
| 996 |
r, |
| 997 |
"exponential histograms should not be equal: %v == %v", |
| 998 |
exponentialHistogramFloat64A, |
| 999 |
exponentialHistogramFloat64B, |
| 1000 |
) |
| 1001 |
|
| 1002 |
r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64C, config{ignoreTimestamp: true}) |
| 1003 |
assert.Empty(t, r, "exponential histograms should be equal: %v", r) |
| 1004 |
|
| 1005 |
r = equalAggregations(exponentialHistogramFloat64A, exponentialHistogramFloat64D, config{ignoreValue: true}) |
| 1006 |
assert.Empty(t, r, "value should be ignored: %v == %v", exponentialHistogramFloat64A, exponentialHistogramFloat64D) |
| 1007 |
|
| 1008 |
r = equalAggregations(summaryA, summaryB, config{}) |
| 1009 |
assert.NotEmptyf(t, r, "summaries should not be equal: %v == %v", summaryA, summaryB) |
| 1010 |
|
| 1011 |
r = equalAggregations(summaryA, summaryC, config{ignoreTimestamp: true}) |
| 1012 |
assert.Empty(t, r, "summaries should be equal: %v", r) |
| 1013 |
|
| 1014 |
r = equalAggregations(summaryA, summaryD, config{ignoreValue: true}) |
| 1015 |
assert.Empty(t, r, "value should be ignored: %v == %v", summaryA, summaryD) |
| 1016 |
} |
| 1017 |
|
| 1018 |
func TestAssertAttributes(t *testing.T) { |
| 1019 |
AssertHasAttributes(t, minFloat64A, attribute.Bool("A", true)) // No-op, always pass. |
| 1020 |
AssertHasAttributes(t, exemplarInt64A, attribute.Bool("filter A", true)) |
| 1021 |
AssertHasAttributes(t, exemplarFloat64A, attribute.Bool("filter A", true)) |
| 1022 |
AssertHasAttributes(t, dataPointInt64A, attribute.Bool("A", true)) |
| 1023 |
AssertHasAttributes(t, dataPointFloat64A, attribute.Bool("A", true)) |
| 1024 |
AssertHasAttributes(t, gaugeInt64A, attribute.Bool("A", true)) |
| 1025 |
AssertHasAttributes(t, gaugeFloat64A, attribute.Bool("A", true)) |
| 1026 |
AssertHasAttributes(t, sumInt64A, attribute.Bool("A", true)) |
| 1027 |
AssertHasAttributes(t, sumFloat64A, attribute.Bool("A", true)) |
| 1028 |
AssertHasAttributes(t, histogramDataPointInt64A, attribute.Bool("A", true)) |
| 1029 |
AssertHasAttributes(t, histogramDataPointFloat64A, attribute.Bool("A", true)) |
| 1030 |
AssertHasAttributes(t, histogramInt64A, attribute.Bool("A", true)) |
| 1031 |
AssertHasAttributes(t, histogramFloat64A, attribute.Bool("A", true)) |
| 1032 |
AssertHasAttributes(t, metricsA, attribute.Bool("A", true)) |
| 1033 |
AssertHasAttributes(t, scopeMetricsA, attribute.Bool("A", true)) |
| 1034 |
AssertHasAttributes(t, resourceMetricsA, attribute.Bool("A", true)) |
| 1035 |
AssertHasAttributes(t, exponentialHistogramDataPointInt64A, attribute.Bool("A", true)) |
| 1036 |
AssertHasAttributes(t, exponentialHistogramDataPointFloat64A, attribute.Bool("A", true)) |
| 1037 |
AssertHasAttributes(t, exponentialHistogramInt64A, attribute.Bool("A", true)) |
| 1038 |
AssertHasAttributes(t, exponentialHistogramFloat64A, attribute.Bool("A", true)) |
| 1039 |
AssertHasAttributes(t, exponentialBucket2, attribute.Bool("A", true)) // No-op, always pass. |
| 1040 |
AssertHasAttributes(t, summaryDataPointA, attribute.Bool("A", true)) |
| 1041 |
AssertHasAttributes(t, summaryA, attribute.Bool("A", true)) |
| 1042 |
AssertHasAttributes(t, quantileValueA, attribute.Bool("A", true)) // No-op, always pass. |
| 1043 |
|
| 1044 |
r := hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", true)) |
| 1045 |
assert.Empty(t, r, "gaugeInt64A has A=True") |
| 1046 |
r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("A", true)) |
| 1047 |
assert.Empty(t, r, "gaugeFloat64A has A=True") |
| 1048 |
r = hasAttributesAggregation(sumInt64A, attribute.Bool("A", true)) |
| 1049 |
assert.Empty(t, r, "sumInt64A has A=True") |
| 1050 |
r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", true)) |
| 1051 |
assert.Empty(t, r, "sumFloat64A has A=True") |
| 1052 |
r = hasAttributesAggregation(histogramInt64A, attribute.Bool("A", true)) |
| 1053 |
assert.Empty(t, r, "histogramInt64A has A=True") |
| 1054 |
r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", true)) |
| 1055 |
assert.Empty(t, r, "histogramFloat64A has A=True") |
| 1056 |
r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("A", true)) |
| 1057 |
assert.Empty(t, r, "exponentialHistogramInt64A has A=True") |
| 1058 |
r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", true)) |
| 1059 |
assert.Empty(t, r, "exponentialHistogramFloat64A has A=True") |
| 1060 |
r = hasAttributesAggregation(summaryA, attribute.Bool("A", true)) |
| 1061 |
assert.Empty(t, r, "summaryA has A=True") |
| 1062 |
|
| 1063 |
r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("A", false)) |
| 1064 |
assert.NotEmpty(t, r, "gaugeInt64A does not have A=False") |
| 1065 |
r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("A", false)) |
| 1066 |
assert.NotEmpty(t, r, "gaugeFloat64A does not have A=False") |
| 1067 |
r = hasAttributesAggregation(sumInt64A, attribute.Bool("A", false)) |
| 1068 |
assert.NotEmpty(t, r, "sumInt64A does not have A=False") |
| 1069 |
r = hasAttributesAggregation(sumFloat64A, attribute.Bool("A", false)) |
| 1070 |
assert.NotEmpty(t, r, "sumFloat64A does not have A=False") |
| 1071 |
r = hasAttributesAggregation(histogramInt64A, attribute.Bool("A", false)) |
| 1072 |
assert.NotEmpty(t, r, "histogramInt64A does not have A=False") |
| 1073 |
r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("A", false)) |
| 1074 |
assert.NotEmpty(t, r, "histogramFloat64A does not have A=False") |
| 1075 |
r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("A", false)) |
| 1076 |
assert.NotEmpty(t, r, "exponentialHistogramInt64A does not have A=False") |
| 1077 |
r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("A", false)) |
| 1078 |
assert.NotEmpty(t, r, "exponentialHistogramFloat64A does not have A=False") |
| 1079 |
r = hasAttributesAggregation(summaryA, attribute.Bool("A", false)) |
| 1080 |
assert.NotEmpty(t, r, "summaryA does not have A=False") |
| 1081 |
|
| 1082 |
r = hasAttributesAggregation(gaugeInt64A, attribute.Bool("B", true)) |
| 1083 |
assert.NotEmpty(t, r, "gaugeInt64A does not have Attribute B") |
| 1084 |
r = hasAttributesAggregation(gaugeFloat64A, attribute.Bool("B", true)) |
| 1085 |
assert.NotEmpty(t, r, "gaugeFloat64A does not have Attribute B") |
| 1086 |
r = hasAttributesAggregation(sumInt64A, attribute.Bool("B", true)) |
| 1087 |
assert.NotEmpty(t, r, "sumInt64A does not have Attribute B") |
| 1088 |
r = hasAttributesAggregation(sumFloat64A, attribute.Bool("B", true)) |
| 1089 |
assert.NotEmpty(t, r, "sumFloat64A does not have Attribute B") |
| 1090 |
r = hasAttributesAggregation(histogramInt64A, attribute.Bool("B", true)) |
| 1091 |
assert.NotEmpty(t, r, "histogramIntA does not have Attribute B") |
| 1092 |
r = hasAttributesAggregation(histogramFloat64A, attribute.Bool("B", true)) |
| 1093 |
assert.NotEmpty(t, r, "histogramFloatA does not have Attribute B") |
| 1094 |
r = hasAttributesAggregation(exponentialHistogramInt64A, attribute.Bool("B", true)) |
| 1095 |
assert.NotEmpty(t, r, "exponentialHistogramIntA does not have Attribute B") |
| 1096 |
r = hasAttributesAggregation(exponentialHistogramFloat64A, attribute.Bool("B", true)) |
| 1097 |
assert.NotEmpty(t, r, "exponentialHistogramFloatA does not have Attribute B") |
| 1098 |
r = hasAttributesAggregation(summaryA, attribute.Bool("B", true)) |
| 1099 |
assert.NotEmpty(t, r, "summaryA does not have Attribute B") |
| 1100 |
} |
| 1101 |
|
| 1102 |
func TestAssertAttributesFail(t *testing.T) { |
| 1103 |
fakeT := &testing.T{} |
| 1104 |
assert.False(t, AssertHasAttributes(fakeT, dataPointInt64A, attribute.Bool("A", false))) |
| 1105 |
assert.False(t, AssertHasAttributes(fakeT, dataPointFloat64A, attribute.Bool("B", true))) |
| 1106 |
assert.False(t, AssertHasAttributes(fakeT, exemplarInt64A, attribute.Bool("A", false))) |
| 1107 |
assert.False(t, AssertHasAttributes(fakeT, exemplarFloat64A, attribute.Bool("B", true))) |
| 1108 |
assert.False(t, AssertHasAttributes(fakeT, gaugeInt64A, attribute.Bool("A", false))) |
| 1109 |
assert.False(t, AssertHasAttributes(fakeT, gaugeFloat64A, attribute.Bool("B", true))) |
| 1110 |
assert.False(t, AssertHasAttributes(fakeT, sumInt64A, attribute.Bool("A", false))) |
| 1111 |
assert.False(t, AssertHasAttributes(fakeT, sumFloat64A, attribute.Bool("B", true))) |
| 1112 |
assert.False(t, AssertHasAttributes(fakeT, histogramDataPointInt64A, attribute.Bool("A", false))) |
| 1113 |
assert.False(t, AssertHasAttributes(fakeT, histogramDataPointFloat64A, attribute.Bool("B", true))) |
| 1114 |
assert.False(t, AssertHasAttributes(fakeT, histogramInt64A, attribute.Bool("A", false))) |
| 1115 |
assert.False(t, AssertHasAttributes(fakeT, histogramFloat64A, attribute.Bool("B", true))) |
| 1116 |
assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("A", false))) |
| 1117 |
assert.False(t, AssertHasAttributes(fakeT, metricsA, attribute.Bool("B", true))) |
| 1118 |
assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("A", false))) |
| 1119 |
assert.False(t, AssertHasAttributes(fakeT, resourceMetricsA, attribute.Bool("B", true))) |
| 1120 |
assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramDataPointInt64A, attribute.Bool("A", false))) |
| 1121 |
assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramDataPointFloat64A, attribute.Bool("B", true))) |
| 1122 |
assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramInt64A, attribute.Bool("A", false))) |
| 1123 |
assert.False(t, AssertHasAttributes(fakeT, exponentialHistogramFloat64A, attribute.Bool("B", true))) |
| 1124 |
assert.False(t, AssertHasAttributes(fakeT, summaryDataPointA, attribute.Bool("A", false))) |
| 1125 |
assert.False(t, AssertHasAttributes(fakeT, summaryDataPointA, attribute.Bool("B", true))) |
| 1126 |
assert.False(t, AssertHasAttributes(fakeT, summaryA, attribute.Bool("A", false))) |
| 1127 |
assert.False(t, AssertHasAttributes(fakeT, summaryA, attribute.Bool("B", true))) |
| 1128 |
|
| 1129 |
sum := metricdata.Sum[int64]{ |
| 1130 |
Temporality: metricdata.CumulativeTemporality, |
| 1131 |
IsMonotonic: true, |
| 1132 |
DataPoints: []metricdata.DataPoint[int64]{ |
| 1133 |
dataPointInt64A, |
| 1134 |
dataPointInt64B, |
| 1135 |
}, |
| 1136 |
} |
| 1137 |
assert.False(t, AssertHasAttributes(fakeT, sum, attribute.Bool("A", true))) |
| 1138 |
} |
| 1139 |
|
| 1140 |
func AssertMarshal[N int64 | float64](t *testing.T, expected string, i *metricdata.Extrema[N]) { |
| 1141 |
t.Helper() |
| 1142 |
|
| 1143 |
b, err := json.Marshal(i) |
| 1144 |
assert.NoError(t, err) |
| 1145 |
assert.Equal(t, expected, string(b)) |
| 1146 |
} |
| 1147 |
|
| 1148 |
func TestAssertMarshal(t *testing.T) { |
| 1149 |
AssertMarshal(t, "null", &metricdata.Extrema[int64]{}) |
| 1150 |
|
| 1151 |
AssertMarshal(t, "-1", &minFloat64A) |
| 1152 |
AssertMarshal(t, "3", &minFloat64B) |
| 1153 |
AssertMarshal(t, "-9.999999", &minFloat64D) |
| 1154 |
AssertMarshal(t, "99", &maxFloat64B) |
| 1155 |
|
| 1156 |
AssertMarshal(t, "-1", &minInt64A) |
| 1157 |
AssertMarshal(t, "3", &minInt64B) |
| 1158 |
AssertMarshal(t, "99", &maxInt64B) |
| 1159 |
} |