mirror of
https://github.com/open-telemetry/opentelemetry-go.git
synced 2025-02-09 13:37:12 +02:00
Bump go.opentelemetry.io/proto/otlp from 0.8.0 to 0.9.0 in /exporters/otlp (#1943)
* Bump go.opentelemetry.io/proto/otlp in /exporters/otlp Bumps [go.opentelemetry.io/proto/otlp](https://github.com/open-telemetry/opentelemetry-proto-go) from 0.8.0 to 0.9.0. - [Release notes](https://github.com/open-telemetry/opentelemetry-proto-go/releases) - [Commits](https://github.com/open-telemetry/opentelemetry-proto-go/compare/v0.8.0...v0.9.0) Signed-off-by: dependabot[bot] <support@github.com> * Auto-fix go.sum changes in dependent modules * Remove use of depreciated StringKeyValue * Revert example/passthrough/go.sum Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: MrAlias <MrAlias@users.noreply.github.com> Co-authored-by: Tyler Yahn <codingalias@gmail.com>
This commit is contained in:
parent
bd935866f4
commit
5a8f7ff74f
@ -51,8 +51,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0 h1:Y0huTcGvPnmeIUuwORZk07LQ2q2CbrXHBkUidvGIoL0=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0/go.mod h1:4i41ohS2vg3FjjjRpBNqfT/voGvIxREH17c6djRtXx8=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0 h1:C0g6TWmQYvjKRnljRULLWUVJGy8Uvu0NEL/5frY2/t4=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -99,7 +99,7 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
@ -290,8 +290,8 @@ go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mI
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0 h1:Y0huTcGvPnmeIUuwORZk07LQ2q2CbrXHBkUidvGIoL0=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0/go.mod h1:4i41ohS2vg3FjjjRpBNqfT/voGvIxREH17c6djRtXx8=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0 h1:C0g6TWmQYvjKRnljRULLWUVJGy8Uvu0NEL/5frY2/t4=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg=
|
||||
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
||||
@ -412,7 +412,7 @@ google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQ
|
||||
google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
@ -18,7 +18,7 @@ require (
|
||||
go.opentelemetry.io/otel/sdk/export/metric v0.20.0
|
||||
go.opentelemetry.io/otel/sdk/metric v0.20.0
|
||||
go.opentelemetry.io/otel/trace v0.20.0
|
||||
go.opentelemetry.io/proto/otlp v0.8.0
|
||||
go.opentelemetry.io/proto/otlp v0.9.0
|
||||
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013
|
||||
google.golang.org/grpc v1.38.0
|
||||
google.golang.org/protobuf v1.26.0
|
||||
|
@ -51,8 +51,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
|
||||
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0 h1:Y0huTcGvPnmeIUuwORZk07LQ2q2CbrXHBkUidvGIoL0=
|
||||
go.opentelemetry.io/proto/otlp v0.8.0/go.mod h1:4i41ohS2vg3FjjjRpBNqfT/voGvIxREH17c6djRtXx8=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0 h1:C0g6TWmQYvjKRnljRULLWUVJGy8Uvu0NEL/5frY2/t4=
|
||||
go.opentelemetry.io/proto/otlp v0.9.0/go.mod h1:1vKfU9rv61e9EVGthD1zNvUbiwPcimSsOPU9brfSHJg=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
@ -99,7 +99,7 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac
|
||||
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=
|
||||
google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk=
|
||||
google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0=
|
||||
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.37.1/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/grpc v1.38.0 h1:/9BgsAsa5nWe26HqOlvlgJnqBuktYOLCgjCPqsa56W0=
|
||||
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
|
||||
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
|
||||
|
@ -313,14 +313,14 @@ func gaugeArray(record export.Record, points []aggregation.Point) (*metricpb.Met
|
||||
Unit: string(desc.Unit()),
|
||||
}
|
||||
|
||||
pbLabels := stringKeyValues(labels.Iter())
|
||||
pbAttrs := keyValues(labels.Iter())
|
||||
|
||||
ndp := make([]*metricpb.NumberDataPoint, 0, len(points))
|
||||
switch nk := desc.NumberKind(); nk {
|
||||
case number.Int64Kind:
|
||||
for _, p := range points {
|
||||
ndp = append(ndp, &metricpb.NumberDataPoint{
|
||||
Labels: pbLabels,
|
||||
Attributes: pbAttrs,
|
||||
StartTimeUnixNano: toNanos(record.StartTime()),
|
||||
TimeUnixNano: toNanos(record.EndTime()),
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
@ -331,7 +331,7 @@ func gaugeArray(record export.Record, points []aggregation.Point) (*metricpb.Met
|
||||
case number.Float64Kind:
|
||||
for _, p := range points {
|
||||
ndp = append(ndp, &metricpb.NumberDataPoint{
|
||||
Labels: pbLabels,
|
||||
Attributes: pbAttrs,
|
||||
StartTimeUnixNano: toNanos(record.StartTime()),
|
||||
TimeUnixNano: toNanos(record.EndTime()),
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{
|
||||
@ -370,7 +370,7 @@ func gaugePoint(record export.Record, num number.Number, start, end time.Time) (
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
AsInt: num.CoerceToInt64(n),
|
||||
},
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(start),
|
||||
TimeUnixNano: toNanos(end),
|
||||
},
|
||||
@ -385,7 +385,7 @@ func gaugePoint(record export.Record, num number.Number, start, end time.Time) (
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{
|
||||
AsDouble: num.CoerceToFloat64(n),
|
||||
},
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(start),
|
||||
TimeUnixNano: toNanos(end),
|
||||
},
|
||||
@ -430,7 +430,7 @@ func sumPoint(record export.Record, num number.Number, start, end time.Time, ek
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
AsInt: num.CoerceToInt64(n),
|
||||
},
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(start),
|
||||
TimeUnixNano: toNanos(end),
|
||||
},
|
||||
@ -447,7 +447,7 @@ func sumPoint(record export.Record, num number.Number, start, end time.Time, ek
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{
|
||||
AsDouble: num.CoerceToFloat64(n),
|
||||
},
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(start),
|
||||
TimeUnixNano: toNanos(end),
|
||||
},
|
||||
@ -497,7 +497,7 @@ func minMaxSumCount(record export.Record, a aggregation.MinMaxSumCount) (*metric
|
||||
DataPoints: []*metricpb.SummaryDataPoint{
|
||||
{
|
||||
Sum: sum.CoerceToFloat64(desc.NumberKind()),
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(record.StartTime()),
|
||||
TimeUnixNano: toNanos(record.EndTime()),
|
||||
Count: uint64(count),
|
||||
@ -561,7 +561,7 @@ func histogramPoint(record export.Record, ek export.ExportKind, a aggregation.Hi
|
||||
DataPoints: []*metricpb.HistogramDataPoint{
|
||||
{
|
||||
Sum: sum.CoerceToFloat64(desc.NumberKind()),
|
||||
Labels: stringKeyValues(labels.Iter()),
|
||||
Attributes: keyValues(labels.Iter()),
|
||||
StartTimeUnixNano: toNanos(record.StartTime()),
|
||||
TimeUnixNano: toNanos(record.EndTime()),
|
||||
Count: uint64(count),
|
||||
@ -575,19 +575,111 @@ func histogramPoint(record export.Record, ek export.ExportKind, a aggregation.Hi
|
||||
return m, nil
|
||||
}
|
||||
|
||||
// stringKeyValues transforms a label iterator into an OTLP StringKeyValues.
|
||||
func stringKeyValues(iter attribute.Iterator) []*commonpb.StringKeyValue {
|
||||
// keyValues transforms an attribute iterator into an OTLP KeyValues.
|
||||
func keyValues(iter attribute.Iterator) []*commonpb.KeyValue {
|
||||
l := iter.Len()
|
||||
if l == 0 {
|
||||
return nil
|
||||
}
|
||||
result := make([]*commonpb.StringKeyValue, 0, l)
|
||||
result := make([]*commonpb.KeyValue, 0, l)
|
||||
for iter.Next() {
|
||||
kv := iter.Label()
|
||||
result = append(result, &commonpb.StringKeyValue{
|
||||
result = append(result, &commonpb.KeyValue{
|
||||
Key: string(kv.Key),
|
||||
Value: kv.Value.Emit(),
|
||||
Value: value(kv.Value),
|
||||
})
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
// value transforms an attribute Value into an OTLP AnyValue.
|
||||
func value(v attribute.Value) *commonpb.AnyValue {
|
||||
switch v.Type() {
|
||||
case attribute.BOOL:
|
||||
return &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_BoolValue{
|
||||
BoolValue: v.AsBool(),
|
||||
},
|
||||
}
|
||||
case attribute.INT64:
|
||||
return &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_IntValue{
|
||||
IntValue: v.AsInt64(),
|
||||
},
|
||||
}
|
||||
case attribute.FLOAT64:
|
||||
return &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_DoubleValue{
|
||||
DoubleValue: v.AsFloat64(),
|
||||
},
|
||||
}
|
||||
case attribute.ARRAY:
|
||||
return &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_ArrayValue{
|
||||
ArrayValue: &commonpb.ArrayValue{
|
||||
Values: arrayValue(v.AsArray()),
|
||||
},
|
||||
},
|
||||
}
|
||||
default:
|
||||
return &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_StringValue{
|
||||
StringValue: v.Emit(),
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// arrayValue transforms an attribute Value of ARRAY type into an slice of
|
||||
// OTLP AnyValue.
|
||||
func arrayValue(arr interface{}) []*commonpb.AnyValue {
|
||||
var av []*commonpb.AnyValue
|
||||
switch val := arr.(type) {
|
||||
case []bool:
|
||||
av = make([]*commonpb.AnyValue, len(val))
|
||||
for i, v := range val {
|
||||
av[i] = &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_BoolValue{
|
||||
BoolValue: v,
|
||||
},
|
||||
}
|
||||
}
|
||||
case []int:
|
||||
av = make([]*commonpb.AnyValue, len(val))
|
||||
for i, v := range val {
|
||||
av[i] = &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_IntValue{
|
||||
IntValue: int64(v),
|
||||
},
|
||||
}
|
||||
}
|
||||
case []int64:
|
||||
av = make([]*commonpb.AnyValue, len(val))
|
||||
for i, v := range val {
|
||||
av[i] = &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_IntValue{
|
||||
IntValue: v,
|
||||
},
|
||||
}
|
||||
}
|
||||
case []float64:
|
||||
av = make([]*commonpb.AnyValue, len(val))
|
||||
for i, v := range val {
|
||||
av[i] = &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_DoubleValue{
|
||||
DoubleValue: v,
|
||||
},
|
||||
}
|
||||
}
|
||||
case []string:
|
||||
av = make([]*commonpb.AnyValue, len(val))
|
||||
for i, v := range val {
|
||||
av[i] = &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_StringValue{
|
||||
StringValue: v,
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
return av
|
||||
}
|
||||
|
@ -56,7 +56,7 @@ const (
|
||||
func TestStringKeyValues(t *testing.T) {
|
||||
tests := []struct {
|
||||
kvs []attribute.KeyValue
|
||||
expected []*commonpb.StringKeyValue
|
||||
expected []*commonpb.KeyValue
|
||||
}{
|
||||
{
|
||||
nil,
|
||||
@ -79,24 +79,24 @@ func TestStringKeyValues(t *testing.T) {
|
||||
attribute.Int("eight", 8),
|
||||
attribute.String("the", "final word"),
|
||||
},
|
||||
[]*commonpb.StringKeyValue{
|
||||
{Key: "eight", Value: "8"},
|
||||
{Key: "five", Value: "5"},
|
||||
{Key: "four", Value: "4"},
|
||||
{Key: "one", Value: "1"},
|
||||
{Key: "seven", Value: "7"},
|
||||
{Key: "six", Value: "6"},
|
||||
{Key: "the", Value: "final word"},
|
||||
{Key: "three", Value: "3"},
|
||||
{Key: "true", Value: "true"},
|
||||
{Key: "two", Value: "2"},
|
||||
[]*commonpb.KeyValue{
|
||||
{Key: "eight", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 8}}},
|
||||
{Key: "five", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 5}}},
|
||||
{Key: "four", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 4}}},
|
||||
{Key: "one", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 1}}},
|
||||
{Key: "seven", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 7}}},
|
||||
{Key: "six", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_DoubleValue{DoubleValue: 6.0}}},
|
||||
{Key: "the", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "final word"}}},
|
||||
{Key: "three", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_DoubleValue{DoubleValue: 3.0}}},
|
||||
{Key: "true", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_BoolValue{BoolValue: true}}},
|
||||
{Key: "two", Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_IntValue{IntValue: 2}}},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
labels := attribute.NewSet(test.kvs...)
|
||||
assert.Equal(t, test.expected, stringKeyValues(labels.Iter()))
|
||||
assert.Equal(t, test.expected, keyValues(labels.Iter()))
|
||||
}
|
||||
}
|
||||
|
||||
@ -135,10 +135,10 @@ func TestMinMaxSumCountDatapoints(t *testing.T) {
|
||||
Sum: 11,
|
||||
StartTimeUnixNano: uint64(intervalStart.UnixNano()),
|
||||
TimeUnixNano: uint64(intervalEnd.UnixNano()),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
QuantileValues: []*metricpb.SummaryDataPoint_ValueAtQuantile{
|
||||
@ -196,10 +196,10 @@ func TestSumIntDataPoints(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{{
|
||||
StartTimeUnixNano: uint64(intervalStart.UnixNano()),
|
||||
TimeUnixNano: uint64(intervalEnd.UnixNano()),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
@ -238,10 +238,10 @@ func TestSumFloatDataPoints(t *testing.T) {
|
||||
},
|
||||
StartTimeUnixNano: uint64(intervalStart.UnixNano()),
|
||||
TimeUnixNano: uint64(intervalEnd.UnixNano()),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
}}}, m.GetSum())
|
||||
@ -269,10 +269,10 @@ func TestLastValueIntDataPoints(t *testing.T) {
|
||||
assert.Equal(t, []*metricpb.NumberDataPoint{{
|
||||
StartTimeUnixNano: 0,
|
||||
TimeUnixNano: uint64(timestamp.UnixNano()),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
@ -304,10 +304,10 @@ func TestExactIntDataPoints(t *testing.T) {
|
||||
assert.Equal(t, []*metricpb.NumberDataPoint{{
|
||||
StartTimeUnixNano: toNanos(intervalStart),
|
||||
TimeUnixNano: toNanos(intervalEnd),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
Value: &metricpb.NumberDataPoint_AsInt{
|
||||
@ -342,10 +342,10 @@ func TestExactFloatDataPoints(t *testing.T) {
|
||||
},
|
||||
StartTimeUnixNano: toNanos(intervalStart),
|
||||
TimeUnixNano: toNanos(intervalEnd),
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
Attributes: []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "one",
|
||||
Value: "1",
|
||||
Value: &commonpb.AnyValue{Value: &commonpb.AnyValue_StringValue{StringValue: "1"}},
|
||||
},
|
||||
},
|
||||
}}, m.GetGauge().DataPoints)
|
||||
|
@ -85,24 +85,40 @@ var (
|
||||
|
||||
testHistogramBoundaries = []float64{2.0, 4.0, 8.0}
|
||||
|
||||
cpu1Labels = []*commonpb.StringKeyValue{
|
||||
cpu1Labels = []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "1",
|
||||
Key: "CPU",
|
||||
Value: &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_IntValue{
|
||||
IntValue: 1,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
Key: "host",
|
||||
Value: &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_StringValue{
|
||||
StringValue: "test.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
cpu2Labels = []*commonpb.StringKeyValue{
|
||||
cpu2Labels = []*commonpb.KeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "2",
|
||||
Key: "CPU",
|
||||
Value: &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_IntValue{
|
||||
IntValue: 2,
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
Key: "host",
|
||||
Value: &commonpb.AnyValue{
|
||||
Value: &commonpb.AnyValue_StringValue{
|
||||
StringValue: "test.com",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
@ -169,13 +185,13 @@ func TestNoGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu2Labels,
|
||||
Attributes: cpu2Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -213,16 +229,7 @@ func TestValuerecorderMetricGroupingExport(t *testing.T) {
|
||||
AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE,
|
||||
DataPoints: []*metricpb.HistogramDataPoint{
|
||||
{
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "1",
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
},
|
||||
},
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
Count: 2,
|
||||
@ -231,16 +238,7 @@ func TestValuerecorderMetricGroupingExport(t *testing.T) {
|
||||
BucketCounts: []uint64{1, 0, 0, 1},
|
||||
},
|
||||
{
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "1",
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
},
|
||||
},
|
||||
Attributes: cpu1Labels,
|
||||
Count: 2,
|
||||
Sum: 11,
|
||||
ExplicitBounds: testHistogramBoundaries,
|
||||
@ -288,13 +286,13 @@ func TestCountInt64MetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -337,32 +335,14 @@ func TestCountFloat64MetricGroupingExport(t *testing.T) {
|
||||
AggregationTemporality: metricpb.AggregationTemporality_AGGREGATION_TEMPORALITY_CUMULATIVE,
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0},
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "1",
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
},
|
||||
},
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0},
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0},
|
||||
Labels: []*commonpb.StringKeyValue{
|
||||
{
|
||||
Key: "CPU",
|
||||
Value: "1",
|
||||
},
|
||||
{
|
||||
Key: "host",
|
||||
Value: "test.com",
|
||||
},
|
||||
},
|
||||
Value: &metricpb.NumberDataPoint_AsDouble{AsDouble: 11.0},
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -431,19 +411,19 @@ func TestResourceMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu2Labels,
|
||||
Attributes: cpu2Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -469,7 +449,7 @@ func TestResourceMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -569,19 +549,19 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu2Labels,
|
||||
Attributes: cpu2Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -606,7 +586,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -630,7 +610,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -660,7 +640,7 @@ func TestResourceInstLibMetricGroupingExport(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
@ -723,7 +703,7 @@ func TestStatelessExportKind(t *testing.T) {
|
||||
DataPoints: []*metricpb.NumberDataPoint{
|
||||
{
|
||||
Value: &metricpb.NumberDataPoint_AsInt{AsInt: 11},
|
||||
Labels: cpu1Labels,
|
||||
Attributes: cpu1Labels,
|
||||
StartTimeUnixNano: startTime(),
|
||||
TimeUnixNano: pointTime(),
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user