Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update otel collector dependency to 0.61.0 #489

Merged
merged 1 commit into from
Sep 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ STABLE_OTEL_VERSION=v1.10.0
UNSTABLE_OTEL_VERSION=v0.32.1
UNSTABLE_CONTRIB_OTEL_VERSION=v0.36.0
STABLE_CONTRIB_OTEL_VERSION=v1.10.0
COLLECTOR_VERSION=v0.60.0
COLLECTOR_VERSION=v0.61.0

.PHONY: update-otel
update-otel:
Expand Down
4 changes: 2 additions & 2 deletions exporter/collector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ require (
github.com/google/go-cmp v0.5.8
github.com/stretchr/testify v1.8.0
go.opencensus.io v0.23.0
go.opentelemetry.io/collector/pdata v0.60.0
go.opentelemetry.io/collector/semconv v0.60.0
go.opentelemetry.io/collector/pdata v0.61.0
go.opentelemetry.io/collector/semconv v0.61.0
go.opentelemetry.io/otel v1.10.0
go.opentelemetry.io/otel/sdk v1.10.0
go.opentelemetry.io/otel/trace v1.10.0
Expand Down
8 changes: 4 additions & 4 deletions exporter/collector/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -240,10 +240,10 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector/pdata v0.60.0 h1:jCNR5jtUom2FcUu30h4tw7enZytwGnXX6fs/K2FM/A0=
go.opentelemetry.io/collector/pdata v0.60.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.60.0 h1:xy6HSukzA5CC8SR4DvFyLd28EFEOnQgxtpU1bSCM0qY=
go.opentelemetry.io/collector/semconv v0.60.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/collector/pdata v0.61.0 h1:jPUReUpR/D1xsigfRxyXA7cYMnXfnK+D7z61W6F9moo=
go.opentelemetry.io/collector/pdata v0.61.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.61.0 h1:RMrzDugNuFsUjppvvNZWiWcNneogZ3Zo4idWyIUWR9k=
go.opentelemetry.io/collector/semconv v0.61.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.0 h1:qZ3KzA4qPzLBDtQyPk4ydjlg8zvXbNysnFHaVMKJbVo=
go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4=
go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
Expand Down
4 changes: 2 additions & 2 deletions exporter/collector/googlemanagedprometheus/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ go 1.18

require (
github.com/stretchr/testify v1.8.0
go.opentelemetry.io/collector/pdata v0.60.0
go.opentelemetry.io/collector/semconv v0.60.0
go.opentelemetry.io/collector/pdata v0.61.0
go.opentelemetry.io/collector/semconv v0.61.0
google.golang.org/genproto v0.0.0-20220405205423-9d709892a2bf
)

Expand Down
8 changes: 4 additions & 4 deletions exporter/collector/googlemanagedprometheus/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PK
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
go.opentelemetry.io/collector/pdata v0.60.0 h1:jCNR5jtUom2FcUu30h4tw7enZytwGnXX6fs/K2FM/A0=
go.opentelemetry.io/collector/pdata v0.60.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.60.0 h1:xy6HSukzA5CC8SR4DvFyLd28EFEOnQgxtpU1bSCM0qY=
go.opentelemetry.io/collector/semconv v0.60.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/collector/pdata v0.61.0 h1:jPUReUpR/D1xsigfRxyXA7cYMnXfnK+D7z61W6F9moo=
go.opentelemetry.io/collector/pdata v0.61.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.61.0 h1:RMrzDugNuFsUjppvvNZWiWcNneogZ3Zo4idWyIUWR9k=
go.opentelemetry.io/collector/semconv v0.61.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func MapToPrometheusTarget(res pcommon.Resource) *monitoredrespb.MonitoredResour
func getStringOrEmpty(attributes pcommon.Map, keys ...string) string {
for _, k := range keys {
if val, ok := attributes.Get(k); ok {
return val.StringVal()
return val.Str()
}
}
return ""
Expand Down
12 changes: 6 additions & 6 deletions exporter/collector/googlemanagedprometheus/naming.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ import (
)

func GetMetricName(baseName string, metric pmetric.Metric) (string, error) {
switch metric.DataType() {
case pmetric.MetricDataTypeSum:
switch metric.Type() {
case pmetric.MetricTypeSum:
return baseName + "/counter", nil
case pmetric.MetricDataTypeGauge:
case pmetric.MetricTypeGauge:
return baseName + "/gauge", nil
case pmetric.MetricDataTypeSummary:
case pmetric.MetricTypeSummary:
// summaries are sent as the following series:
// * Sum: prometheus.googleapis.com/<baseName>_sum/summary:counter
// * Count: prometheus.googleapis.com/<baseName>_count/summary
Expand All @@ -36,9 +36,9 @@ func GetMetricName(baseName string, metric pmetric.Metric) (string, error) {
return baseName + "/summary:counter", nil
}
return baseName + "/summary", nil
case pmetric.MetricDataTypeHistogram:
case pmetric.MetricTypeHistogram:
return baseName + "/histogram", nil
default:
return "", fmt.Errorf("unsupported metric datatype: %v", metric.DataType())
return "", fmt.Errorf("unsupported metric datatype: %v", metric.Type())
}
}
30 changes: 15 additions & 15 deletions exporter/collector/googlemanagedprometheus/naming_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,76 +26,76 @@ func TestGetMetricName(t *testing.T) {
desc string
baseName string
expected string
datatype pmetric.MetricDataType
datatype pmetric.MetricType
expectErr bool
}{
{
desc: "sum",
baseName: "foo_total",
datatype: pmetric.MetricDataTypeSum,
datatype: pmetric.MetricTypeSum,
expected: "foo_total/counter",
},
{
desc: "gauge",
baseName: "bar",
datatype: pmetric.MetricDataTypeGauge,
datatype: pmetric.MetricTypeGauge,
expected: "bar/gauge",
},
{
desc: "summary sum",
baseName: "baz_sum",
datatype: pmetric.MetricDataTypeSummary,
datatype: pmetric.MetricTypeSummary,
expected: "baz_sum/summary:counter",
},
{
desc: "summary count",
baseName: "baz_count",
datatype: pmetric.MetricDataTypeSummary,
datatype: pmetric.MetricTypeSummary,
expected: "baz_count/summary",
},
{
desc: "summary quantile",
baseName: "baz",
datatype: pmetric.MetricDataTypeSummary,
datatype: pmetric.MetricTypeSummary,
expected: "baz/summary",
},
{
desc: "histogram sum",
baseName: "hello_sum",
datatype: pmetric.MetricDataTypeHistogram,
datatype: pmetric.MetricTypeHistogram,
expected: "hello_sum/histogram",
},
{
desc: "histogram count",
baseName: "hello_count",
datatype: pmetric.MetricDataTypeHistogram,
datatype: pmetric.MetricTypeHistogram,
expected: "hello_count/histogram",
},
{
desc: "histogram bucket",
baseName: "hello",
datatype: pmetric.MetricDataTypeHistogram,
datatype: pmetric.MetricTypeHistogram,
expected: "hello/histogram",
},
{
desc: "other",
baseName: "other",
datatype: pmetric.MetricDataTypeExponentialHistogram,
datatype: pmetric.MetricTypeExponentialHistogram,
expectErr: true,
},
} {
t.Run(tc.desc, func(t *testing.T) {
metric := pmetric.NewMetric()
switch tc.datatype {
case pmetric.MetricDataTypeSum:
case pmetric.MetricTypeSum:
metric.SetEmptySum()
case pmetric.MetricDataTypeGauge:
case pmetric.MetricTypeGauge:
metric.SetEmptyGauge()
case pmetric.MetricDataTypeSummary:
case pmetric.MetricTypeSummary:
metric.SetEmptySummary()
case pmetric.MetricDataTypeHistogram:
case pmetric.MetricTypeHistogram:
metric.SetEmptyHistogram()
case pmetric.MetricDataTypeExponentialHistogram:
case pmetric.MetricTypeExponentialHistogram:
metric.SetEmptyExponentialHistogram()
}
got, err := GetMetricName(tc.baseName, metric)
Expand Down
6 changes: 3 additions & 3 deletions exporter/collector/integrationtest/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ require (
github.com/google/go-cmp v0.5.8
github.com/stretchr/testify v1.8.0
go.opencensus.io v0.23.0
go.opentelemetry.io/collector v0.60.0
go.opentelemetry.io/collector/pdata v0.60.0
go.opentelemetry.io/collector v0.61.0
go.opentelemetry.io/collector/pdata v0.61.0
go.uber.org/zap v1.23.0
google.golang.org/api v0.74.0
google.golang.org/genproto v0.0.0-20220829175752-36a9c930ecbf
Expand Down Expand Up @@ -45,7 +45,7 @@ require (
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
go.opentelemetry.io/collector/semconv v0.60.0 // indirect
go.opentelemetry.io/collector/semconv v0.61.0 // indirect
go.opentelemetry.io/otel v1.10.0 // indirect
go.opentelemetry.io/otel/metric v0.32.1 // indirect
go.opentelemetry.io/otel/sdk v1.10.0 // indirect
Expand Down
12 changes: 6 additions & 6 deletions exporter/collector/integrationtest/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -407,12 +407,12 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0 h1:gqCw0LfLxScz8irSi8exQc7fyQ0fKQU/qnC/X8+V/1M=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opentelemetry.io/collector v0.60.0 h1:rHndW/xILGjNoFaYIvwYpngZnRWw1oQT6GLtzxIs7pw=
go.opentelemetry.io/collector v0.60.0/go.mod h1:n2KBSgs7AakuedVxLR/Tayl3EEztmngrrjZBsYS+qBI=
go.opentelemetry.io/collector/pdata v0.60.0 h1:jCNR5jtUom2FcUu30h4tw7enZytwGnXX6fs/K2FM/A0=
go.opentelemetry.io/collector/pdata v0.60.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.60.0 h1:xy6HSukzA5CC8SR4DvFyLd28EFEOnQgxtpU1bSCM0qY=
go.opentelemetry.io/collector/semconv v0.60.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/collector v0.61.0 h1:lvuhmlskup6Z3AfQKZwuRk43jRClB+1FkwjGXRoxhfs=
go.opentelemetry.io/collector v0.61.0/go.mod h1:515eomlUIwLEXTBwLAEEtl2HPreJy5xtv//LYMk/SZE=
go.opentelemetry.io/collector/pdata v0.61.0 h1:jPUReUpR/D1xsigfRxyXA7cYMnXfnK+D7z61W6F9moo=
go.opentelemetry.io/collector/pdata v0.61.0/go.mod h1:0hqgNMRneVXaLNelv3q0XKJbyBW9aMDwyC15pKd30+E=
go.opentelemetry.io/collector/semconv v0.61.0 h1:RMrzDugNuFsUjppvvNZWiWcNneogZ3Zo4idWyIUWR9k=
go.opentelemetry.io/collector/semconv v0.61.0/go.mod h1:aRkHuJ/OshtDFYluKEtnG5nkKTsy1HZuvZVHmakx+Vo=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.36.0 h1:qZ3KzA4qPzLBDtQyPk4ydjlg8zvXbNysnFHaVMKJbVo=
go.opentelemetry.io/otel v1.10.0 h1:Y7DTJMR6zs1xkS/upamJYk0SxxN4C9AqRd77jmZnyY4=
go.opentelemetry.io/otel v1.10.0/go.mod h1:NbvWjCthWHKBEUMpf0/v8ZRZlni86PpGFEMA9pnQSnQ=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func setSecondProjectInLogs(t *testing.T, logs plog.Logs) {
require.NotEmpty(t, secondProject, "set the SECOND_PROJECT_ID environment to run this test")
for i := 0; i < logs.ResourceLogs().Len(); i++ {
if project, found := logs.ResourceLogs().At(i).Resource().Attributes().Get(resourcemapping.ProjectIDAttributeKey); found {
project.SetStringVal(secondProject)
project.SetStr(secondProject)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func setSecondProjectInMetrics(t *testing.T, metrics pmetric.Metrics) {
require.NotEmpty(t, secondProject, "set the SECOND_PROJECT_ID environment to run this test")
for i := 0; i < metrics.ResourceMetrics().Len(); i++ {
if project, found := metrics.ResourceMetrics().At(i).Resource().Attributes().Get(resourcemapping.ProjectIDAttributeKey); found {
project.SetStringVal(secondProject)
project.SetStr(secondProject)
}
}
}
12 changes: 6 additions & 6 deletions exporter/collector/integrationtest/testcases/testcase.go
Original file line number Diff line number Diff line change
Expand Up @@ -272,24 +272,24 @@ func (tc *TestCase) LoadOTLPMetricsInput(
for i := 0; i < sms.Metrics().Len(); i++ {
m := sms.Metrics().At(i)

switch m.DataType() {
case pmetric.MetricDataTypeGauge:
switch m.Type() {
case pmetric.MetricTypeGauge:
for i := 0; i < m.Gauge().DataPoints().Len(); i++ {
updatePoint(m.Gauge().DataPoints().At(i))
}
case pmetric.MetricDataTypeSum:
case pmetric.MetricTypeSum:
for i := 0; i < m.Sum().DataPoints().Len(); i++ {
updatePoint(m.Sum().DataPoints().At(i))
}
case pmetric.MetricDataTypeHistogram:
case pmetric.MetricTypeHistogram:
for i := 0; i < m.Histogram().DataPoints().Len(); i++ {
updatePoint(m.Histogram().DataPoints().At(i))
}
case pmetric.MetricDataTypeSummary:
case pmetric.MetricTypeSummary:
for i := 0; i < m.Summary().DataPoints().Len(); i++ {
updatePoint(m.Summary().DataPoints().At(i))
}
case pmetric.MetricDataTypeExponentialHistogram:
case pmetric.MetricTypeExponentialHistogram:
for i := 0; i < m.ExponentialHistogram().DataPoints().Len(); i++ {
updatePoint(m.ExponentialHistogram().DataPoints().At(i))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ func (s *standardNormalizer) NormalizeNumberDataPoint(point pmetric.NumberDataPo
func lessThanNumberDataPoint(a, b pmetric.NumberDataPoint) bool {
switch a.ValueType() {
case pmetric.NumberDataPointValueTypeInt:
return a.IntVal() < b.IntVal()
return a.IntValue() < b.IntValue()
case pmetric.NumberDataPointValueTypeDouble:
return a.DoubleVal() < b.DoubleVal()
return a.DoubleValue() < b.DoubleValue()
}
return false
}
Expand All @@ -334,9 +334,9 @@ func subtractNumberDataPoint(a, b pmetric.NumberDataPoint) pmetric.NumberDataPoi
// Adjust the value based on the start point's value
switch newPoint.ValueType() {
case pmetric.NumberDataPointValueTypeInt:
newPoint.SetIntVal(a.IntVal() - b.IntVal())
newPoint.SetIntValue(a.IntValue() - b.IntValue())
case pmetric.NumberDataPointValueTypeDouble:
newPoint.SetDoubleVal(a.DoubleVal() - b.DoubleVal())
newPoint.SetDoubleValue(a.DoubleValue() - b.DoubleValue())
}
return newPoint
}
Expand Down
14 changes: 7 additions & 7 deletions exporter/collector/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ func (l logMapper) logToSplitEntries(
// parse LogEntrySourceLocation struct from OTel attribute
if sourceLocation, ok := attrsMap[SourceLocationAttributeKey]; ok {
var logEntrySourceLocation logpb.LogEntrySourceLocation
err := json.Unmarshal(sourceLocation.BytesVal().AsRaw(), &logEntrySourceLocation)
err := json.Unmarshal(sourceLocation.Bytes().AsRaw(), &logEntrySourceLocation)
if err != nil {
return []logging.Entry{entry}, err
}
Expand All @@ -357,7 +357,7 @@ func (l logMapper) logToSplitEntries(

// parse TraceSampled boolean from OTel attribute
if traceSampled, ok := attrsMap[TraceSampledAttributeKey]; ok {
entry.TraceSampled = traceSampled.BoolVal()
entry.TraceSampled = traceSampled.Bool()
delete(attrsMap, TraceSampledAttributeKey)
}

Expand Down Expand Up @@ -476,11 +476,11 @@ func parseEntryPayload(logBody pcommon.Value, maxEntrySize int) (interface{}, in
}
switch logBody.Type() {
case pcommon.ValueTypeBytes:
return logBody.BytesVal().AsRaw(), 1, nil
case pcommon.ValueTypeString:
return logBody.Bytes().AsRaw(), 1, nil
case pcommon.ValueTypeStr:
return logBody.AsString(), int(math.Ceil(float64(len([]byte(logBody.AsString()))) / float64(maxEntrySize))), nil
case pcommon.ValueTypeMap:
return logBody.MapVal().AsRaw(), 1, nil
return logBody.Map().AsRaw(), 1, nil

default:
return nil, 0, fmt.Errorf("unknown log body value %v", logBody.Type().String())
Expand Down Expand Up @@ -511,8 +511,8 @@ func (l logMapper) parseHTTPRequest(httpRequestAttr pcommon.Value) (*logging.HTT
var bytes []byte
switch httpRequestAttr.Type() {
case pcommon.ValueTypeBytes:
bytes = httpRequestAttr.BytesVal().AsRaw()
case pcommon.ValueTypeString, pcommon.ValueTypeMap:
bytes = httpRequestAttr.Bytes().AsRaw()
case pcommon.ValueTypeStr, pcommon.ValueTypeMap:
bytes = []byte(httpRequestAttr.AsString())
}

Expand Down
8 changes: 4 additions & 4 deletions exporter/collector/logs_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestLogMapping(t *testing.T) {
maxEntrySize: 3 + 51, // 3 bytes for payload + 51 for overhead
log: func() plog.LogRecord {
log := plog.NewLogRecord()
log.Body().SetStringVal("abcxyz")
log.Body().SetStr("abcxyz")
return log
},
expectedEntries: []logging.Entry{
Expand Down Expand Up @@ -98,7 +98,7 @@ func TestLogMapping(t *testing.T) {
name: "log with json, empty monitoredresource",
log: func() plog.LogRecord {
log := plog.NewLogRecord()
log.Body().SetEmptyBytesVal().FromRaw([]byte(`{"this": "is json"}`))
log.Body().SetEmptyBytes().FromRaw([]byte(`{"this": "is json"}`))
return log
},
mr: func() *monitoredres.MonitoredResource {
Expand All @@ -116,7 +116,7 @@ func TestLogMapping(t *testing.T) {
name: "log with json and httpRequest, empty monitoredresource",
log: func() plog.LogRecord {
log := plog.NewLogRecord()
log.Body().SetEmptyBytesVal().FromRaw([]byte(`{"message": "hello!"}`))
log.Body().SetEmptyBytes().FromRaw([]byte(`{"message": "hello!"}`))
log.Attributes().PutEmptyBytes(HTTPRequestAttributeKey).FromRaw([]byte(`{
"requestMethod": "GET",
"requestURL": "https://www.example.com",
Expand Down Expand Up @@ -181,7 +181,7 @@ func TestLogMapping(t *testing.T) {
},
log: func() plog.LogRecord {
log := plog.NewLogRecord()
log.Body().SetStringVal("{\"message\": \"hello!\"}")
log.Body().SetStr("{\"message\": \"hello!\"}")
return log
},
expectedEntries: []logging.Entry{
Expand Down
Loading