Azure Monitor: Add support for numeric fields in ARG (#38728)

* Fix todouble/toreal not working

* fix test
This commit is contained in:
shuotli 2021-09-01 00:02:08 -07:00 committed by GitHub
parent 38ca27428d
commit f2c4346cc4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 2 deletions

View File

@ -72,6 +72,7 @@ var converterMap = map[string]data.FieldConverter{
"bool": boolConverter, "bool": boolConverter,
"decimal": decimalConverter, "decimal": decimalConverter,
"integer": intConverter, "integer": intConverter,
"number": decimalConverter,
} }
var stringConverter = data.FieldConverter{ var stringConverter = data.FieldConverter{

View File

@ -115,10 +115,11 @@ func TestLogTableToFrame(t *testing.T) {
data.NewField("XTimeSpan", nil, []*string{pointer.String("00:00:00.0000001")}), data.NewField("XTimeSpan", nil, []*string{pointer.String("00:00:00.0000001")}),
data.NewField("XDecimal", nil, []*float64{pointer.Float64(79228162514264337593543950335)}), data.NewField("XDecimal", nil, []*float64{pointer.Float64(79228162514264337593543950335)}),
data.NewField("XObject", nil, []*string{pointer.String(`"{\"person\": \"Daniel\", \"cats\": 23, \"diagnosis\": \"cat problem\"}"`)}), data.NewField("XObject", nil, []*string{pointer.String(`"{\"person\": \"Daniel\", \"cats\": 23, \"diagnosis\": \"cat problem\"}"`)}),
data.NewField("XNumber", nil, []*float64{pointer.Float64(79228162514264337593543950335)}),
) )
frame.Meta = &data.FrameMeta{ frame.Meta = &data.FrameMeta{
Custom: &LogAnalyticsMeta{ColumnTypes: []string{"bool", "string", "datetime", Custom: &LogAnalyticsMeta{ColumnTypes: []string{"bool", "string", "datetime",
"dynamic", "guid", "int", "long", "real", "timespan", "decimal", "object"}}, "dynamic", "guid", "int", "long", "real", "timespan", "decimal", "object", "number"}},
} }
return frame return frame
}, },

View File

@ -46,6 +46,10 @@
{ {
"name":"XObject", "name":"XObject",
"type":"object" "type":"object"
},
{
"name":"XNumber",
"type":"number"
} }
], ],
"rows": [ "rows": [
@ -60,7 +64,8 @@
1.7976931348623157e+308, 1.7976931348623157e+308,
"00:00:00.0000001", "00:00:00.0000001",
"79228162514264337593543950335", "79228162514264337593543950335",
"{\"person\": \"Daniel\", \"cats\": 23, \"diagnosis\": \"cat problem\"}" "{\"person\": \"Daniel\", \"cats\": 23, \"diagnosis\": \"cat problem\"}",
"79228162514264337593543950335"
] ]
] ]
} }