Skip to content

Commit

Permalink
add min/max to exponential histogram as well
Browse files Browse the repository at this point in the history
  • Loading branch information
Alex Boten committed Mar 1, 2022
1 parent e4957d8 commit 53371f1
Show file tree
Hide file tree
Showing 3 changed files with 122 additions and 20 deletions.
54 changes: 34 additions & 20 deletions model/internal/cmd/pdatagen/internal/metrics_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,32 +294,14 @@ var histogramDataPoint = &messageValueStruct{
originFieldName: "Min_",
originTypePrefix: "otlpmetrics.HistogramDataPoint_",
testValueIdx: 0, // Double
values: []oneOfValue{
&oneOfPrimitiveValue{
fieldName: "Min",
fieldType: "Double",
originFieldName: "Min",
returnType: "float64",
defaultVal: "float64(0.0)",
testVal: "float64(17.13)",
},
},
values: []oneOfValue{minField},
},
&oneOfField{
typeName: "OptionalType",
originFieldName: "Max_",
originTypePrefix: "otlpmetrics.HistogramDataPoint_",
testValueIdx: 0, // Double
values: []oneOfValue{
&oneOfPrimitiveValue{
fieldName: "Max",
fieldType: "Double",
originFieldName: "Max",
returnType: "float64",
defaultVal: "float64(0.0)",
testVal: "float64(17.13)",
},
},
values: []oneOfValue{maxField},
},
},
}
Expand Down Expand Up @@ -370,6 +352,20 @@ var exponentialHistogramDataPoint = &messageValueStruct{
},
exemplarsField,
dataPointFlagsField,
&oneOfField{
typeName: "OptionalType",
originFieldName: "Min_",
originTypePrefix: "otlpmetrics.ExponentialHistogramDataPoint_",
testValueIdx: 0, // Double
values: []oneOfValue{minField},
},
&oneOfField{
typeName: "OptionalType",
originFieldName: "Max_",
originTypePrefix: "otlpmetrics.ExponentialHistogramDataPoint_",
testValueIdx: 0, // Double
values: []oneOfValue{maxField},
},
},
}

Expand Down Expand Up @@ -556,3 +552,21 @@ var dataPointFlagsField = &primitiveTypedField{
defaultVal: "MetricDataPointFlagsNone",
testVal: "MetricDataPointFlagsNone",
}

var minField = &oneOfPrimitiveValue{
fieldName: "Min",
fieldType: "Double",
originFieldName: "Min",
returnType: "float64",
defaultVal: "float64(0.0)",
testVal: "float64(17.13)",
}

var maxField = &oneOfPrimitiveValue{
fieldName: "Max",
fieldType: "Double",
originFieldName: "Max",
returnType: "float64",
defaultVal: "float64(0.0)",
testVal: "float64(17.13)",
}
54 changes: 54 additions & 0 deletions model/pdata/generated_metrics.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions model/pdata/generated_metrics_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 53371f1

Please sign in to comment.