[chore] Implement pooling support for oneOf messages (#13692)
Updates https://github.com/open-telemetry/opentelemetry-collector/issues/13631 Signed-off-by: Bogdan Drutu <bogdandrutu@gmail.com>
This commit is contained in:
parent
1a001d98c3
commit
cbe449b18a
|
|
@ -14,6 +14,8 @@ type Field interface {
|
||||||
|
|
||||||
GenerateTestEncodingValues(ms *messageStruct) string
|
GenerateTestEncodingValues(ms *messageStruct) string
|
||||||
|
|
||||||
|
GeneratePoolOrig(ms *messageStruct) string
|
||||||
|
|
||||||
GenerateDeleteOrig(ms *messageStruct) string
|
GenerateDeleteOrig(ms *messageStruct) string
|
||||||
|
|
||||||
GenerateCopyOrig(ms *messageStruct) string
|
GenerateCopyOrig(ms *messageStruct) string
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,10 @@ func (mf *MessageField) GenerateCopyOrig(ms *messageStruct) string {
|
||||||
return template.Execute(t, mf.templateFields(ms))
|
return template.Execute(t, mf.templateFields(ms))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mf *MessageField) GeneratePoolOrig(*messageStruct) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (mf *MessageField) GenerateMarshalJSON(*messageStruct) string {
|
func (mf *MessageField) GenerateMarshalJSON(*messageStruct) string {
|
||||||
return mf.toProtoField().GenMarshalJSON()
|
return mf.toProtoField().GenMarshalJSON()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,11 @@ const oneOfTestValuesTemplate = `
|
||||||
{{ .GenerateTestEncodingValues $.baseStruct $.OneOfField }}
|
{{ .GenerateTestEncodingValues $.baseStruct $.OneOfField }}
|
||||||
{{- end }}`
|
{{- end }}`
|
||||||
|
|
||||||
|
const oneOfPoolOrigTemplate = `
|
||||||
|
{{- range .values }}
|
||||||
|
{{ .GeneratePoolOrig $.baseStruct $.OneOfField }}
|
||||||
|
{{- end }}`
|
||||||
|
|
||||||
const oneOfDeleteOrigTemplate = `switch ov := orig.{{ .originFieldName }}.(type) {
|
const oneOfDeleteOrigTemplate = `switch ov := orig.{{ .originFieldName }}.(type) {
|
||||||
{{ range .values -}}
|
{{ range .values -}}
|
||||||
case *{{ $.originTypePrefix }}{{ .GetOriginFieldName }}:
|
case *{{ $.originTypePrefix }}{{ .GetOriginFieldName }}:
|
||||||
|
|
@ -124,18 +129,12 @@ func (of *OneOfField) GenerateTestEncodingValues(ms *messageStruct) string {
|
||||||
return template.Execute(template.Parse("oneOfTestValuesTemplate", []byte(oneOfTestValuesTemplate)), of.templateFields(ms))
|
return template.Execute(template.Parse("oneOfTestValuesTemplate", []byte(oneOfTestValuesTemplate)), of.templateFields(ms))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (of *OneOfField) GeneratePoolOrig(ms *messageStruct) string {
|
||||||
|
return template.Execute(template.Parse("oneOfPoolOrigTemplate", []byte(oneOfPoolOrigTemplate)), of.templateFields(ms))
|
||||||
|
}
|
||||||
|
|
||||||
func (of *OneOfField) GenerateDeleteOrig(ms *messageStruct) string {
|
func (of *OneOfField) GenerateDeleteOrig(ms *messageStruct) string {
|
||||||
atLeastOneMessage := false
|
return template.Execute(template.Parse("oneOfDeleteOrigTemplate", []byte(oneOfDeleteOrigTemplate)), of.templateFields(ms))
|
||||||
for i := range of.values {
|
|
||||||
if _, ok := of.values[i].(*OneOfMessageValue); ok {
|
|
||||||
atLeastOneMessage = true
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if atLeastOneMessage {
|
|
||||||
return template.Execute(template.Parse("oneOfDeleteOrigTemplate", []byte(oneOfDeleteOrigTemplate)), of.templateFields(ms))
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (of *OneOfField) GenerateCopyOrig(ms *messageStruct) string {
|
func (of *OneOfField) GenerateCopyOrig(ms *messageStruct) string {
|
||||||
|
|
@ -173,6 +172,7 @@ func (of *OneOfField) templateFields(ms *messageStruct) map[string]any {
|
||||||
"structName": ms.getName(),
|
"structName": ms.getName(),
|
||||||
"typeFuncName": of.typeFuncName(),
|
"typeFuncName": of.typeFuncName(),
|
||||||
"typeName": of.typeName,
|
"typeName": of.typeName,
|
||||||
|
"originName": ms.getOriginName(),
|
||||||
"originFieldName": of.originFieldName,
|
"originFieldName": of.originFieldName,
|
||||||
"lowerOriginFieldName": strings.ToLower(of.originFieldName),
|
"lowerOriginFieldName": strings.ToLower(of.originFieldName),
|
||||||
"origAccessor": origAccessor(ms.getHasWrapper()),
|
"origAccessor": origAccessor(ms.getHasWrapper()),
|
||||||
|
|
@ -191,6 +191,7 @@ type oneOfValue interface {
|
||||||
GenerateTestValue(ms *messageStruct, of *OneOfField) string
|
GenerateTestValue(ms *messageStruct, of *OneOfField) string
|
||||||
GenerateTestFailingUnmarshalProtoValues(ms *messageStruct, of *OneOfField) string
|
GenerateTestFailingUnmarshalProtoValues(ms *messageStruct, of *OneOfField) string
|
||||||
GenerateTestEncodingValues(ms *messageStruct, of *OneOfField) string
|
GenerateTestEncodingValues(ms *messageStruct, of *OneOfField) string
|
||||||
|
GeneratePoolOrig(ms *messageStruct, of *OneOfField) string
|
||||||
GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string
|
GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string
|
||||||
GenerateCopyOrig(ms *messageStruct, of *OneOfField) string
|
GenerateCopyOrig(ms *messageStruct, of *OneOfField) string
|
||||||
GenerateType(ms *messageStruct, of *OneOfField) string
|
GenerateType(ms *messageStruct, of *OneOfField) string
|
||||||
|
|
|
||||||
|
|
@ -96,6 +96,10 @@ func (omv *OneOfMessageValue) GenerateTestEncodingValues(ms *messageStruct, of *
|
||||||
return omv.toProtoField(ms, of, false).GenTestEncodingValues()
|
return omv.toProtoField(ms, of, false).GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (omv *OneOfMessageValue) GeneratePoolOrig(ms *messageStruct, of *OneOfField) string {
|
||||||
|
return omv.toProtoField(ms, of, false).GenPoolVarOrig()
|
||||||
|
}
|
||||||
|
|
||||||
func (omv *OneOfMessageValue) GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string {
|
func (omv *OneOfMessageValue) GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string {
|
||||||
return omv.toProtoField(ms, of, false).GenDeleteOrig()
|
return omv.toProtoField(ms, of, false).GenDeleteOrig()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -91,6 +91,10 @@ func (opv *OneOfPrimitiveValue) GenerateTestEncodingValues(ms *messageStruct, of
|
||||||
return opv.toProtoField(ms, of, false).GenTestEncodingValues()
|
return opv.toProtoField(ms, of, false).GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (opv *OneOfPrimitiveValue) GeneratePoolOrig(ms *messageStruct, of *OneOfField) string {
|
||||||
|
return opv.toProtoField(ms, of, false).GenPoolVarOrig()
|
||||||
|
}
|
||||||
|
|
||||||
func (opv *OneOfPrimitiveValue) GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string {
|
func (opv *OneOfPrimitiveValue) GenerateDeleteOrig(ms *messageStruct, of *OneOfField) string {
|
||||||
return opv.toProtoField(ms, of, false).GenDeleteOrig()
|
return opv.toProtoField(ms, of, false).GenDeleteOrig()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -76,18 +76,15 @@ type OptionalPrimitiveField struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateAccessors(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateAccessors(ms *messageStruct) string {
|
||||||
t := template.Parse("optionalPrimitiveAccessorsTemplate", []byte(optionalPrimitiveAccessorsTemplate))
|
return template.Execute(template.Parse("optionalPrimitiveAccessorsTemplate", []byte(optionalPrimitiveAccessorsTemplate)), opv.templateFields(ms))
|
||||||
return template.Execute(t, opv.templateFields(ms))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateAccessorsTest(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateAccessorsTest(ms *messageStruct) string {
|
||||||
t := template.Parse("optionalPrimitiveAccessorsTestTemplate", []byte(optionalPrimitiveAccessorsTestTemplate))
|
return template.Execute(template.Parse("optionalPrimitiveAccessorsTestTemplate", []byte(optionalPrimitiveAccessorsTestTemplate)), opv.templateFields(ms))
|
||||||
return template.Execute(t, opv.templateFields(ms))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateTestValue(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateTestValue(ms *messageStruct) string {
|
||||||
t := template.Parse("optionalPrimitiveSetTestTemplate", []byte(optionalPrimitiveSetTestTemplate))
|
return template.Execute(template.Parse("optionalPrimitiveSetTestTemplate", []byte(optionalPrimitiveSetTestTemplate)), opv.templateFields(ms))
|
||||||
return template.Execute(t, opv.templateFields(ms))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateTestFailingUnmarshalProtoValues(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateTestFailingUnmarshalProtoValues(ms *messageStruct) string {
|
||||||
|
|
@ -98,13 +95,16 @@ func (opv *OptionalPrimitiveField) GenerateTestEncodingValues(ms *messageStruct)
|
||||||
return opv.toProtoField(ms, false).GenTestEncodingValues()
|
return opv.toProtoField(ms, false).GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (opv *OptionalPrimitiveField) GeneratePoolOrig(ms *messageStruct) string {
|
||||||
|
return opv.toProtoField(ms, false).GenPoolVarOrig()
|
||||||
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateDeleteOrig(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateDeleteOrig(ms *messageStruct) string {
|
||||||
return opv.toProtoField(ms, false).GenDeleteOrig()
|
return "switch ov := orig." + opv.fieldName + "_.(type) {\n\tcase *" + ms.getOriginFullName() + "_" + opv.fieldName + ":\n\t" + opv.toProtoField(ms, false).GenDeleteOrig() + "\n}\n"
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateCopyOrig(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateCopyOrig(ms *messageStruct) string {
|
||||||
t := template.Parse("optionalPrimitiveCopyOrigTemplate", []byte(optionalPrimitiveCopyOrigTemplate))
|
return template.Execute(template.Parse("optionalPrimitiveCopyOrigTemplate", []byte(optionalPrimitiveCopyOrigTemplate)), opv.templateFields(ms))
|
||||||
return template.Execute(t, opv.templateFields(ms))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (opv *OptionalPrimitiveField) GenerateMarshalJSON(ms *messageStruct) string {
|
func (opv *OptionalPrimitiveField) GenerateMarshalJSON(ms *messageStruct) string {
|
||||||
|
|
@ -152,8 +152,9 @@ func (opv *OptionalPrimitiveField) templateFields(ms *messageStruct) map[string]
|
||||||
"lowerFieldName": strings.ToLower(opv.fieldName),
|
"lowerFieldName": strings.ToLower(opv.fieldName),
|
||||||
"testValue": pf.TestValue(),
|
"testValue": pf.TestValue(),
|
||||||
"returnType": pf.GoType(),
|
"returnType": pf.GoType(),
|
||||||
"originStructName": ms.originFullName,
|
"originName": ms.getOriginName(),
|
||||||
"originStructType": ms.originFullName + "_" + opv.fieldName,
|
"originStructName": ms.getOriginFullName(),
|
||||||
|
"originStructType": ms.getOriginFullName() + "_" + opv.fieldName,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,10 @@ func (pf *PrimitiveField) GenerateTestEncodingValues(*messageStruct) string {
|
||||||
return pf.toProtoField().GenTestEncodingValues()
|
return pf.toProtoField().GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pf *PrimitiveField) GeneratePoolOrig(*messageStruct) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (pf *PrimitiveField) GenerateDeleteOrig(*messageStruct) string {
|
func (pf *PrimitiveField) GenerateDeleteOrig(*messageStruct) string {
|
||||||
return pf.toProtoField().GenDeleteOrig()
|
return pf.toProtoField().GenDeleteOrig()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,10 @@ func (sf *SliceField) GenerateTestEncodingValues(*messageStruct) string {
|
||||||
return sf.toProtoField().GenTestEncodingValues()
|
return sf.toProtoField().GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (sf *SliceField) GeneratePoolOrig(*messageStruct) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (sf *SliceField) GenerateDeleteOrig(*messageStruct) string {
|
func (sf *SliceField) GenerateDeleteOrig(*messageStruct) string {
|
||||||
return sf.toProtoField().GenDeleteOrig()
|
return sf.toProtoField().GenDeleteOrig()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,15 @@ func New{{ .structName }}(orig *{{ .originFullName }}, state *State) {{ .structN
|
||||||
|
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
var protoPool{{ .originName }} = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPool{{ .originName }} = sync.Pool{
|
||||||
return &{{ .originFullName }}{}
|
New: func() any {
|
||||||
},
|
return &{{ .originFullName }}{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
{{- range .fields }}{{ .GeneratePoolOrig $.messageStruct }}{{- end }}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
func NewOrig{{ .originName }}() *{{ .originFullName }} {
|
func NewOrig{{ .originName }}() *{{ .originFullName }} {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -57,7 +61,7 @@ func DeleteOrig{{ .originName }}(orig *{{ .originFullName }}, nullable bool) {
|
||||||
|
|
||||||
{{ range .fields }}{{ .GenerateDeleteOrig $.messageStruct }}{{ end }}
|
{{ range .fields }}{{ .GenerateDeleteOrig $.messageStruct }}{{ end }}
|
||||||
orig.Reset()
|
orig.Reset()
|
||||||
if nullable {
|
if nullable {
|
||||||
protoPool{{ .originName }}.Put(orig)
|
protoPool{{ .originName }}.Put(orig)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,10 @@ func (ptf *TypedField) GenerateTestEncodingValues(*messageStruct) string {
|
||||||
return ptf.toProtoField().GenTestEncodingValues()
|
return ptf.toProtoField().GenTestEncodingValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ptf *TypedField) GeneratePoolOrig(*messageStruct) string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (ptf *TypedField) GenerateDeleteOrig(*messageStruct) string {
|
func (ptf *TypedField) GenerateDeleteOrig(*messageStruct) string {
|
||||||
return ptf.toProtoField().GenDeleteOrig()
|
return ptf.toProtoField().GenDeleteOrig()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,12 @@ import (
|
||||||
"go.opentelemetry.io/collector/internal/cmd/pdatagen/internal/template"
|
"go.opentelemetry.io/collector/internal/cmd/pdatagen/internal/template"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const deleteOrigOther = `{{ if ne .oneOfGroup "" -}}
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPool{{ .oneOfMessageName }}.Put(ov)
|
||||||
|
}
|
||||||
|
{{ end }}`
|
||||||
|
|
||||||
const deleteOrigMessage = `{{ if .repeated -}}
|
const deleteOrigMessage = `{{ if .repeated -}}
|
||||||
for i := range orig.{{ .fieldName }} {
|
for i := range orig.{{ .fieldName }} {
|
||||||
{{ if .nullable -}}
|
{{ if .nullable -}}
|
||||||
|
|
@ -16,6 +22,9 @@ const deleteOrigMessage = `{{ if .repeated -}}
|
||||||
{{- end }}
|
{{- end }}
|
||||||
}
|
}
|
||||||
{{- else if ne .oneOfGroup "" -}}
|
{{- else if ne .oneOfGroup "" -}}
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPool{{ .oneOfMessageName }}.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrig{{ .origName }}(ov.{{ .fieldName }}, true)
|
DeleteOrig{{ .origName }}(ov.{{ .fieldName }}, true)
|
||||||
{{- else if .nullable -}}
|
{{- else if .nullable -}}
|
||||||
DeleteOrig{{ .origName }}(orig.{{ .fieldName }}, true)
|
DeleteOrig{{ .origName }}(orig.{{ .fieldName }}, true)
|
||||||
|
|
@ -29,5 +38,8 @@ func (pf *Field) GenDeleteOrig() string {
|
||||||
if pf.Type == TypeMessage {
|
if pf.Type == TypeMessage {
|
||||||
return template.Execute(template.Parse("deleteOrigMessage", []byte(deleteOrigMessage)), tf)
|
return template.Execute(template.Parse("deleteOrigMessage", []byte(deleteOrigMessage)), tf)
|
||||||
}
|
}
|
||||||
|
if pf.OneOfGroup != "" {
|
||||||
|
return template.Execute(template.Parse("deleteOrigOther", []byte(deleteOrigOther)), tf)
|
||||||
|
}
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -128,6 +128,7 @@ func (pf *Field) getTemplateFields() map[string]any {
|
||||||
"origName": pf.messageName(),
|
"origName": pf.messageName(),
|
||||||
"origFullName": pf.MessageFullName,
|
"origFullName": pf.MessageFullName,
|
||||||
"oneOfGroup": pf.OneOfGroup,
|
"oneOfGroup": pf.OneOfGroup,
|
||||||
|
"oneOfMessageName": ExtractNameFromFull(pf.OneOfMessageFullName),
|
||||||
"oneOfMessageFullName": pf.OneOfMessageFullName,
|
"oneOfMessageFullName": pf.OneOfMessageFullName,
|
||||||
"repeated": pf.Repeated,
|
"repeated": pf.Repeated,
|
||||||
"nullable": pf.Nullable,
|
"nullable": pf.Nullable,
|
||||||
|
|
|
||||||
|
|
@ -19,9 +19,14 @@ const unmarshalJSONPrimitive = ` case {{ .allJSONTags }}:
|
||||||
}
|
}
|
||||||
{{ else if .nullable -}}
|
{{ else if .nullable -}}
|
||||||
{
|
{
|
||||||
ofm := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofm.{{ .fieldName }} = iter.Read{{ upperFirst .goType }}()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofm
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = iter.Read{{ upperFirst .goType }}()
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
}
|
}
|
||||||
{{ else -}}
|
{{ else -}}
|
||||||
orig.{{ .fieldName }} = iter.Read{{ upperFirst .goType }}()
|
orig.{{ .fieldName }} = iter.Read{{ upperFirst .goType }}()
|
||||||
|
|
@ -44,10 +49,15 @@ const unmarshalJSONMessage = ` case {{ .allJSONTags }}:
|
||||||
}
|
}
|
||||||
{{ else if ne .oneOfGroup "" -}}
|
{{ else if ne .oneOfGroup "" -}}
|
||||||
{
|
{
|
||||||
ofm := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofm.{{ .fieldName }} = NewOrig{{ .origName }}()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrig{{ .origName }}(ofm.{{ .fieldName }}, iter)
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
orig.{{ .oneOfGroup }} = ofm
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = NewOrig{{ .origName }}()
|
||||||
|
UnmarshalJSONOrig{{ .origName }}(ov.{{ .fieldName }}, iter)
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
}
|
}
|
||||||
{{ else -}}
|
{{ else -}}
|
||||||
UnmarshalJSONOrig{{ .origName }}({{ if not .nullable }}&{{ end }}orig.{{ .fieldName }}, iter)
|
UnmarshalJSONOrig{{ .origName }}({{ if not .nullable }}&{{ end }}orig.{{ .fieldName }}, iter)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
// Copyright The OpenTelemetry Authors
|
||||||
|
// SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
package proto // import "go.opentelemetry.io/collector/internal/cmd/pdatagen/internal/proto"
|
||||||
|
|
||||||
|
import (
|
||||||
|
"go.opentelemetry.io/collector/internal/cmd/pdatagen/internal/template"
|
||||||
|
)
|
||||||
|
|
||||||
|
const poolVarOrigTemplate = `
|
||||||
|
protoPool{{ .oneOfMessageName }} = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &{{ .oneOfMessageFullName }}{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
`
|
||||||
|
|
||||||
|
func (pf *Field) GenPoolVarOrig() string {
|
||||||
|
tf := pf.getTemplateFields()
|
||||||
|
if pf.OneOfGroup != "" {
|
||||||
|
return template.Execute(template.Parse("poolVarOrigTemplate", []byte(poolVarOrigTemplate)), tf)
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
@ -44,9 +44,14 @@ const unmarshalProtoFloat = `{{ if .repeated -}}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = math.Float{{ .bitSize }}frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = math.Float{{ .bitSize }}frombits(num)
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else }}
|
{{- else }}
|
||||||
orig.{{ .fieldName }} = math.Float{{ .bitSize }}frombits(num)
|
orig.{{ .fieldName }} = math.Float{{ .bitSize }}frombits(num)
|
||||||
{{- end }}{{- end }}`
|
{{- end }}{{- end }}`
|
||||||
|
|
@ -86,9 +91,14 @@ const unmarshalProtoFixed = `{{ if .repeated -}}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = {{ .goType }}(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = {{ .goType }}(num)
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else }}
|
{{- else }}
|
||||||
orig.{{ .fieldName }} = {{ .goType }}(num)
|
orig.{{ .fieldName }} = {{ .goType }}(num)
|
||||||
{{- end }}{{- end }}`
|
{{- end }}{{- end }}`
|
||||||
|
|
@ -128,9 +138,14 @@ const unmarshalProtoBool = `{{ if .repeated -}}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = num != 0
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = num != 0
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else }}
|
{{- else }}
|
||||||
orig.{{ .fieldName }} = num != 0
|
orig.{{ .fieldName }} = num != 0
|
||||||
{{- end }}{{- end }}`
|
{{- end }}{{- end }}`
|
||||||
|
|
@ -168,9 +183,14 @@ const unmarshalProtoVarint = `{{ if .repeated -}}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = {{ .goType }}(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = {{ .goType }}(num)
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else }}
|
{{- else }}
|
||||||
orig.{{ .fieldName }} = {{ .goType }}(num)
|
orig.{{ .fieldName }} = {{ .goType }}(num)
|
||||||
{{- end }}{{- end }}`
|
{{- end }}{{- end }}`
|
||||||
|
|
@ -187,9 +207,14 @@ const unmarshalProtoString = `
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = string(buf[startPos:pos])
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = string(buf[startPos:pos])
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else if .repeated -}}
|
{{- else if .repeated -}}
|
||||||
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, string(buf[startPos:pos]))
|
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, string(buf[startPos:pos]))
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
|
|
@ -208,10 +233,15 @@ const unmarshalProtoBytes = `
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = make([]byte, length)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = make([]byte, length)
|
||||||
copy(ofv.{{ .fieldName }}, buf[startPos:pos])
|
copy(ofv.{{ .fieldName }}, buf[startPos:pos])
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else if .repeated -}}
|
{{- else if .repeated -}}
|
||||||
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, make([]byte, length))
|
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, make([]byte, length))
|
||||||
copy(orig.{{ .fieldName }}[len(orig.{{ .fieldName }}) - 1], buf[startPos:pos])
|
copy(orig.{{ .fieldName }}[len(orig.{{ .fieldName }}) - 1], buf[startPos:pos])
|
||||||
|
|
@ -232,13 +262,18 @@ const unmarshalProtoMessage = `
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
ofv := &{{ .oneOfMessageFullName }}{}
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
ofv.{{ .fieldName }} = NewOrig{{ .origName }}()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrig{{ .origName }}(ofv.{{ .fieldName }}, buf[startPos:pos])
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = NewOrig{{ .origName }}()
|
||||||
|
err = UnmarshalProtoOrig{{ .origName }}(ov.{{ .fieldName }}, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.{{ .oneOfGroup }} = ofv
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else if .repeated -}}
|
{{- else if .repeated -}}
|
||||||
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, {{ if .nullable }}NewOrig{{ .origName }}(){{ else }}{{ .defaultValue }}{{ end }})
|
orig.{{ .fieldName }} = append(orig.{{ .fieldName }}, {{ if .nullable }}NewOrig{{ .origName }}(){{ else }}{{ .defaultValue }}{{ end }})
|
||||||
err = UnmarshalProtoOrig{{ .origName }}({{ if not .nullable }}&{{ end }}orig.{{ .fieldName }}[len(orig.{{ .fieldName }})-1], buf[startPos:pos])
|
err = UnmarshalProtoOrig{{ .origName }}({{ if not .nullable }}&{{ end }}orig.{{ .fieldName }}[len(orig.{{ .fieldName }})-1], buf[startPos:pos])
|
||||||
|
|
@ -288,7 +323,14 @@ const unmarshalProtoSignedVarint = `{{ if .repeated -}}
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
{{ if ne .oneOfGroup "" -}}
|
{{ if ne .oneOfGroup "" -}}
|
||||||
orig.{{ .oneOfGroup }} = &{{ .oneOfMessageFullName }} { {{ .fieldName }}: int{{ .bitSize }}(uint{{ .bitSize }}(num >> 1) ^ uint{{ .bitSize }}(int{{ .bitSize }}((num&1)<<{{ sub .bitSize 1 }})>>{{ sub .bitSize 1 }})) }
|
var ov *{{ .oneOfMessageFullName }}
|
||||||
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
ov = &{{ .oneOfMessageFullName }}{}
|
||||||
|
} else {
|
||||||
|
ov = protoPool{{ .oneOfMessageName }}.Get().(*{{ .oneOfMessageFullName }})
|
||||||
|
}
|
||||||
|
ov.{{ .fieldName }} = int{{ .bitSize }}(uint{{ .bitSize }}(num >> 1) ^ uint{{ .bitSize }}(int{{ .bitSize }}((num&1)<<{{ sub .bitSize 1 }})>>{{ sub .bitSize 1 }}))
|
||||||
|
orig.{{ .oneOfGroup }} = ov
|
||||||
{{- else }}
|
{{- else }}
|
||||||
orig.{{ .fieldName }} = int{{ .bitSize }}(uint{{ .bitSize }}(num >> 1) ^ uint{{ .bitSize }}(int{{ .bitSize }}((num&1)<<{{ sub .bitSize 1 }})>>{{ sub .bitSize 1 }}))
|
orig.{{ .fieldName }} = int{{ .bitSize }}(uint{{ .bitSize }}(num >> 1) ^ uint{{ .bitSize }}(int{{ .bitSize }}((num&1)<<{{ sub .bitSize 1 }})>>{{ sub .bitSize 1 }}))
|
||||||
{{- end }}{{- end }}`
|
{{- end }}{{- end }}`
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolArrayValue = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolArrayValue = sync.Pool{
|
||||||
return &otlpcommon.ArrayValue{}
|
New: func() any {
|
||||||
},
|
return &otlpcommon.ArrayValue{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigArrayValue() *otlpcommon.ArrayValue {
|
func NewOrigArrayValue() *otlpcommon.ArrayValue {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolAttributeUnit = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolAttributeUnit = sync.Pool{
|
||||||
return &otlpprofiles.AttributeUnit{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.AttributeUnit{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigAttributeUnit() *otlpprofiles.AttributeUnit {
|
func NewOrigAttributeUnit() *otlpprofiles.AttributeUnit {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewEntityRef(orig *otlpcommon.EntityRef, state *State) EntityRef {
|
||||||
return EntityRef{orig: orig, state: state}
|
return EntityRef{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolEntityRef = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolEntityRef = sync.Pool{
|
||||||
return &otlpcommon.EntityRef{}
|
New: func() any {
|
||||||
},
|
return &otlpcommon.EntityRef{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigEntityRef() *otlpcommon.EntityRef {
|
func NewOrigEntityRef() *otlpcommon.EntityRef {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -19,11 +19,25 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExemplar = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExemplar = sync.Pool{
|
||||||
return &otlpmetrics.Exemplar{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Exemplar{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolExemplar_AsDouble = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Exemplar_AsDouble{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolExemplar_AsInt = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Exemplar_AsInt{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExemplar() *otlpmetrics.Exemplar {
|
func NewOrigExemplar() *otlpmetrics.Exemplar {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -45,6 +59,17 @@ func DeleteOrigExemplar(orig *otlpmetrics.Exemplar, nullable bool) {
|
||||||
for i := range orig.FilteredAttributes {
|
for i := range orig.FilteredAttributes {
|
||||||
DeleteOrigKeyValue(&orig.FilteredAttributes[i], false)
|
DeleteOrigKeyValue(&orig.FilteredAttributes[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Value.(type) {
|
||||||
|
case *otlpmetrics.Exemplar_AsDouble:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolExemplar_AsDouble.Put(ov)
|
||||||
|
}
|
||||||
|
case *otlpmetrics.Exemplar_AsInt:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolExemplar_AsInt.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
DeleteOrigSpanID(&orig.SpanId, false)
|
DeleteOrigSpanID(&orig.SpanId, false)
|
||||||
DeleteOrigTraceID(&orig.TraceId, false)
|
DeleteOrigTraceID(&orig.TraceId, false)
|
||||||
|
|
||||||
|
|
@ -132,16 +157,26 @@ func UnmarshalJSONOrigExemplar(orig *otlpmetrics.Exemplar, iter *json.Iterator)
|
||||||
|
|
||||||
case "asDouble", "as_double":
|
case "asDouble", "as_double":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Exemplar_AsDouble{}
|
var ov *otlpmetrics.Exemplar_AsDouble
|
||||||
ofm.AsDouble = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofm
|
ov = &otlpmetrics.Exemplar_AsDouble{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExemplar_AsDouble.Get().(*otlpmetrics.Exemplar_AsDouble)
|
||||||
|
}
|
||||||
|
ov.AsDouble = iter.ReadFloat64()
|
||||||
|
orig.Value = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "asInt", "as_int":
|
case "asInt", "as_int":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Exemplar_AsInt{}
|
var ov *otlpmetrics.Exemplar_AsInt
|
||||||
ofm.AsInt = iter.ReadInt64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofm
|
ov = &otlpmetrics.Exemplar_AsInt{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExemplar_AsInt.Get().(*otlpmetrics.Exemplar_AsInt)
|
||||||
|
}
|
||||||
|
ov.AsInt = iter.ReadInt64()
|
||||||
|
orig.Value = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "spanId", "span_id":
|
case "spanId", "span_id":
|
||||||
|
|
@ -277,9 +312,14 @@ func UnmarshalProtoOrigExemplar(orig *otlpmetrics.Exemplar, buf []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.Exemplar_AsDouble{}
|
var ov *otlpmetrics.Exemplar_AsDouble
|
||||||
ofv.AsDouble = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofv
|
ov = &otlpmetrics.Exemplar_AsDouble{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExemplar_AsDouble.Get().(*otlpmetrics.Exemplar_AsDouble)
|
||||||
|
}
|
||||||
|
ov.AsDouble = math.Float64frombits(num)
|
||||||
|
orig.Value = ov
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
if wireType != proto.WireTypeI64 {
|
if wireType != proto.WireTypeI64 {
|
||||||
|
|
@ -290,9 +330,14 @@ func UnmarshalProtoOrigExemplar(orig *otlpmetrics.Exemplar, buf []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.Exemplar_AsInt{}
|
var ov *otlpmetrics.Exemplar_AsInt
|
||||||
ofv.AsInt = int64(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofv
|
ov = &otlpmetrics.Exemplar_AsInt{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExemplar_AsInt.Get().(*otlpmetrics.Exemplar_AsInt)
|
||||||
|
}
|
||||||
|
ov.AsInt = int64(num)
|
||||||
|
orig.Value = ov
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExponentialHistogram = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExponentialHistogram = sync.Pool{
|
||||||
return &otlpmetrics.ExponentialHistogram{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.ExponentialHistogram{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExponentialHistogram() *otlpmetrics.ExponentialHistogram {
|
func NewOrigExponentialHistogram() *otlpmetrics.ExponentialHistogram {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,30 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExponentialHistogramDataPoint = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExponentialHistogramDataPoint = sync.Pool{
|
||||||
return &otlpmetrics.ExponentialHistogramDataPoint{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.ExponentialHistogramDataPoint{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
protoPoolExponentialHistogramDataPoint_Sum = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.ExponentialHistogramDataPoint_Sum{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolExponentialHistogramDataPoint_Min = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.ExponentialHistogramDataPoint_Min{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolExponentialHistogramDataPoint_Max = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.ExponentialHistogramDataPoint_Max{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExponentialHistogramDataPoint() *otlpmetrics.ExponentialHistogramDataPoint {
|
func NewOrigExponentialHistogramDataPoint() *otlpmetrics.ExponentialHistogramDataPoint {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -44,11 +63,32 @@ func DeleteOrigExponentialHistogramDataPoint(orig *otlpmetrics.ExponentialHistog
|
||||||
for i := range orig.Attributes {
|
for i := range orig.Attributes {
|
||||||
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Sum_.(type) {
|
||||||
|
case *otlpmetrics.ExponentialHistogramDataPoint_Sum:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolExponentialHistogramDataPoint_Sum.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
DeleteOrigExponentialHistogramDataPoint_Buckets(&orig.Positive, false)
|
DeleteOrigExponentialHistogramDataPoint_Buckets(&orig.Positive, false)
|
||||||
DeleteOrigExponentialHistogramDataPoint_Buckets(&orig.Negative, false)
|
DeleteOrigExponentialHistogramDataPoint_Buckets(&orig.Negative, false)
|
||||||
for i := range orig.Exemplars {
|
for i := range orig.Exemplars {
|
||||||
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Min_.(type) {
|
||||||
|
case *otlpmetrics.ExponentialHistogramDataPoint_Min:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolExponentialHistogramDataPoint_Min.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
switch ov := orig.Max_.(type) {
|
||||||
|
case *otlpmetrics.ExponentialHistogramDataPoint_Max:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolExponentialHistogramDataPoint_Max.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
orig.Reset()
|
orig.Reset()
|
||||||
if nullable {
|
if nullable {
|
||||||
|
|
@ -211,9 +251,14 @@ func UnmarshalJSONOrigExponentialHistogramDataPoint(orig *otlpmetrics.Exponentia
|
||||||
orig.Count = iter.ReadUint64()
|
orig.Count = iter.ReadUint64()
|
||||||
case "sum":
|
case "sum":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.ExponentialHistogramDataPoint_Sum{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Sum
|
||||||
ofm.Sum = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Sum_ = ofm
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Sum{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Sum.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = iter.ReadFloat64()
|
||||||
|
orig.Sum_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "scale":
|
case "scale":
|
||||||
|
|
@ -234,16 +279,26 @@ func UnmarshalJSONOrigExponentialHistogramDataPoint(orig *otlpmetrics.Exponentia
|
||||||
|
|
||||||
case "min":
|
case "min":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.ExponentialHistogramDataPoint_Min{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Min
|
||||||
ofm.Min = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Min_ = ofm
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Min{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Min.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Min)
|
||||||
|
}
|
||||||
|
ov.Min = iter.ReadFloat64()
|
||||||
|
orig.Min_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "max":
|
case "max":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.ExponentialHistogramDataPoint_Max{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Max
|
||||||
ofm.Max = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Max_ = ofm
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Max{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Max.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Max)
|
||||||
|
}
|
||||||
|
ov.Max = iter.ReadFloat64()
|
||||||
|
orig.Max_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "zeroThreshold", "zero_threshold":
|
case "zeroThreshold", "zero_threshold":
|
||||||
|
|
@ -474,9 +529,14 @@ func UnmarshalProtoOrigExponentialHistogramDataPoint(orig *otlpmetrics.Exponenti
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.ExponentialHistogramDataPoint_Sum{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Sum
|
||||||
ofv.Sum = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Sum_ = ofv
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Sum{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Sum.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = math.Float64frombits(num)
|
||||||
|
orig.Sum_ = ov
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
if wireType != proto.WireTypeVarint {
|
if wireType != proto.WireTypeVarint {
|
||||||
|
|
@ -571,9 +631,14 @@ func UnmarshalProtoOrigExponentialHistogramDataPoint(orig *otlpmetrics.Exponenti
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.ExponentialHistogramDataPoint_Min{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Min
|
||||||
ofv.Min = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Min_ = ofv
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Min{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Min.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Min)
|
||||||
|
}
|
||||||
|
ov.Min = math.Float64frombits(num)
|
||||||
|
orig.Min_ = ov
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
if wireType != proto.WireTypeI64 {
|
if wireType != proto.WireTypeI64 {
|
||||||
|
|
@ -584,9 +649,14 @@ func UnmarshalProtoOrigExponentialHistogramDataPoint(orig *otlpmetrics.Exponenti
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.ExponentialHistogramDataPoint_Max{}
|
var ov *otlpmetrics.ExponentialHistogramDataPoint_Max
|
||||||
ofv.Max = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Max_ = ofv
|
ov = &otlpmetrics.ExponentialHistogramDataPoint_Max{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolExponentialHistogramDataPoint_Max.Get().(*otlpmetrics.ExponentialHistogramDataPoint_Max)
|
||||||
|
}
|
||||||
|
ov.Max = math.Float64frombits(num)
|
||||||
|
orig.Max_ = ov
|
||||||
|
|
||||||
case 14:
|
case 14:
|
||||||
if wireType != proto.WireTypeI64 {
|
if wireType != proto.WireTypeI64 {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExponentialHistogramDataPoint_Buckets = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExponentialHistogramDataPoint_Buckets = sync.Pool{
|
||||||
return &otlpmetrics.ExponentialHistogramDataPoint_Buckets{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.ExponentialHistogramDataPoint_Buckets{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExponentialHistogramDataPoint_Buckets() *otlpmetrics.ExponentialHistogramDataPoint_Buckets {
|
func NewOrigExponentialHistogramDataPoint_Buckets() *otlpmetrics.ExponentialHistogramDataPoint_Buckets {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportLogsPartialSuccess = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportLogsPartialSuccess = sync.Pool{
|
||||||
return &otlpcollectorlogs.ExportLogsPartialSuccess{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorlogs.ExportLogsPartialSuccess{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportLogsPartialSuccess() *otlpcollectorlogs.ExportLogsPartialSuccess {
|
func NewOrigExportLogsPartialSuccess() *otlpcollectorlogs.ExportLogsPartialSuccess {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewLogs(orig *otlpcollectorlogs.ExportLogsServiceRequest, state *State) Log
|
||||||
return Logs{orig: orig, state: state}
|
return Logs{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolExportLogsServiceRequest = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportLogsServiceRequest = sync.Pool{
|
||||||
return &otlpcollectorlogs.ExportLogsServiceRequest{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorlogs.ExportLogsServiceRequest{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportLogsServiceRequest() *otlpcollectorlogs.ExportLogsServiceRequest {
|
func NewOrigExportLogsServiceRequest() *otlpcollectorlogs.ExportLogsServiceRequest {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportLogsServiceResponse = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportLogsServiceResponse = sync.Pool{
|
||||||
return &otlpcollectorlogs.ExportLogsServiceResponse{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorlogs.ExportLogsServiceResponse{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportLogsServiceResponse() *otlpcollectorlogs.ExportLogsServiceResponse {
|
func NewOrigExportLogsServiceResponse() *otlpcollectorlogs.ExportLogsServiceResponse {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportMetricsPartialSuccess = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportMetricsPartialSuccess = sync.Pool{
|
||||||
return &otlpcollectormetrics.ExportMetricsPartialSuccess{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectormetrics.ExportMetricsPartialSuccess{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportMetricsPartialSuccess() *otlpcollectormetrics.ExportMetricsPartialSuccess {
|
func NewOrigExportMetricsPartialSuccess() *otlpcollectormetrics.ExportMetricsPartialSuccess {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewMetrics(orig *otlpcollectormetrics.ExportMetricsServiceRequest, state *S
|
||||||
return Metrics{orig: orig, state: state}
|
return Metrics{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolExportMetricsServiceRequest = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportMetricsServiceRequest = sync.Pool{
|
||||||
return &otlpcollectormetrics.ExportMetricsServiceRequest{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectormetrics.ExportMetricsServiceRequest{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportMetricsServiceRequest() *otlpcollectormetrics.ExportMetricsServiceRequest {
|
func NewOrigExportMetricsServiceRequest() *otlpcollectormetrics.ExportMetricsServiceRequest {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportMetricsServiceResponse = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportMetricsServiceResponse = sync.Pool{
|
||||||
return &otlpcollectormetrics.ExportMetricsServiceResponse{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectormetrics.ExportMetricsServiceResponse{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportMetricsServiceResponse() *otlpcollectormetrics.ExportMetricsServiceResponse {
|
func NewOrigExportMetricsServiceResponse() *otlpcollectormetrics.ExportMetricsServiceResponse {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportProfilesPartialSuccess = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportProfilesPartialSuccess = sync.Pool{
|
||||||
return &otlpcollectorprofiles.ExportProfilesPartialSuccess{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorprofiles.ExportProfilesPartialSuccess{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportProfilesPartialSuccess() *otlpcollectorprofiles.ExportProfilesPartialSuccess {
|
func NewOrigExportProfilesPartialSuccess() *otlpcollectorprofiles.ExportProfilesPartialSuccess {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewProfiles(orig *otlpcollectorprofiles.ExportProfilesServiceRequest, state
|
||||||
return Profiles{orig: orig, state: state}
|
return Profiles{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolExportProfilesServiceRequest = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportProfilesServiceRequest = sync.Pool{
|
||||||
return &otlpcollectorprofiles.ExportProfilesServiceRequest{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorprofiles.ExportProfilesServiceRequest{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportProfilesServiceRequest() *otlpcollectorprofiles.ExportProfilesServiceRequest {
|
func NewOrigExportProfilesServiceRequest() *otlpcollectorprofiles.ExportProfilesServiceRequest {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportProfilesServiceResponse = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportProfilesServiceResponse = sync.Pool{
|
||||||
return &otlpcollectorprofiles.ExportProfilesServiceResponse{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectorprofiles.ExportProfilesServiceResponse{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportProfilesServiceResponse() *otlpcollectorprofiles.ExportProfilesServiceResponse {
|
func NewOrigExportProfilesServiceResponse() *otlpcollectorprofiles.ExportProfilesServiceResponse {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportTracePartialSuccess = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportTracePartialSuccess = sync.Pool{
|
||||||
return &otlpcollectortrace.ExportTracePartialSuccess{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectortrace.ExportTracePartialSuccess{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportTracePartialSuccess() *otlpcollectortrace.ExportTracePartialSuccess {
|
func NewOrigExportTracePartialSuccess() *otlpcollectortrace.ExportTracePartialSuccess {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewTraces(orig *otlpcollectortrace.ExportTraceServiceRequest, state *State)
|
||||||
return Traces{orig: orig, state: state}
|
return Traces{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolExportTraceServiceRequest = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportTraceServiceRequest = sync.Pool{
|
||||||
return &otlpcollectortrace.ExportTraceServiceRequest{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectortrace.ExportTraceServiceRequest{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportTraceServiceRequest() *otlpcollectortrace.ExportTraceServiceRequest {
|
func NewOrigExportTraceServiceRequest() *otlpcollectortrace.ExportTraceServiceRequest {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolExportTraceServiceResponse = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolExportTraceServiceResponse = sync.Pool{
|
||||||
return &otlpcollectortrace.ExportTraceServiceResponse{}
|
New: func() any {
|
||||||
},
|
return &otlpcollectortrace.ExportTraceServiceResponse{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigExportTraceServiceResponse() *otlpcollectortrace.ExportTraceServiceResponse {
|
func NewOrigExportTraceServiceResponse() *otlpcollectortrace.ExportTraceServiceResponse {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolFunction = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolFunction = sync.Pool{
|
||||||
return &otlpprofiles.Function{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Function{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigFunction() *otlpprofiles.Function {
|
func NewOrigFunction() *otlpprofiles.Function {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolGauge = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolGauge = sync.Pool{
|
||||||
return &otlpmetrics.Gauge{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Gauge{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigGauge() *otlpmetrics.Gauge {
|
func NewOrigGauge() *otlpmetrics.Gauge {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolHistogram = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolHistogram = sync.Pool{
|
||||||
return &otlpmetrics.Histogram{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Histogram{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigHistogram() *otlpmetrics.Histogram {
|
func NewOrigHistogram() *otlpmetrics.Histogram {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,30 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolHistogramDataPoint = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolHistogramDataPoint = sync.Pool{
|
||||||
return &otlpmetrics.HistogramDataPoint{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.HistogramDataPoint{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
protoPoolHistogramDataPoint_Sum = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.HistogramDataPoint_Sum{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolHistogramDataPoint_Min = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.HistogramDataPoint_Min{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolHistogramDataPoint_Max = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.HistogramDataPoint_Max{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigHistogramDataPoint() *otlpmetrics.HistogramDataPoint {
|
func NewOrigHistogramDataPoint() *otlpmetrics.HistogramDataPoint {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -44,9 +63,30 @@ func DeleteOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint, nullable
|
||||||
for i := range orig.Attributes {
|
for i := range orig.Attributes {
|
||||||
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Sum_.(type) {
|
||||||
|
case *otlpmetrics.HistogramDataPoint_Sum:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolHistogramDataPoint_Sum.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
for i := range orig.Exemplars {
|
for i := range orig.Exemplars {
|
||||||
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Min_.(type) {
|
||||||
|
case *otlpmetrics.HistogramDataPoint_Min:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolHistogramDataPoint_Min.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
switch ov := orig.Max_.(type) {
|
||||||
|
case *otlpmetrics.HistogramDataPoint_Max:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolHistogramDataPoint_Max.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
orig.Reset()
|
orig.Reset()
|
||||||
if nullable {
|
if nullable {
|
||||||
|
|
@ -207,9 +247,14 @@ func UnmarshalJSONOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint, i
|
||||||
orig.Count = iter.ReadUint64()
|
orig.Count = iter.ReadUint64()
|
||||||
case "sum":
|
case "sum":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.HistogramDataPoint_Sum{}
|
var ov *otlpmetrics.HistogramDataPoint_Sum
|
||||||
ofm.Sum = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Sum_ = ofm
|
ov = &otlpmetrics.HistogramDataPoint_Sum{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Sum.Get().(*otlpmetrics.HistogramDataPoint_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = iter.ReadFloat64()
|
||||||
|
orig.Sum_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "bucketCounts", "bucket_counts":
|
case "bucketCounts", "bucket_counts":
|
||||||
|
|
@ -232,16 +277,26 @@ func UnmarshalJSONOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint, i
|
||||||
orig.Flags = iter.ReadUint32()
|
orig.Flags = iter.ReadUint32()
|
||||||
case "min":
|
case "min":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.HistogramDataPoint_Min{}
|
var ov *otlpmetrics.HistogramDataPoint_Min
|
||||||
ofm.Min = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Min_ = ofm
|
ov = &otlpmetrics.HistogramDataPoint_Min{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Min.Get().(*otlpmetrics.HistogramDataPoint_Min)
|
||||||
|
}
|
||||||
|
ov.Min = iter.ReadFloat64()
|
||||||
|
orig.Min_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "max":
|
case "max":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.HistogramDataPoint_Max{}
|
var ov *otlpmetrics.HistogramDataPoint_Max
|
||||||
ofm.Max = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Max_ = ofm
|
ov = &otlpmetrics.HistogramDataPoint_Max{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Max.Get().(*otlpmetrics.HistogramDataPoint_Max)
|
||||||
|
}
|
||||||
|
ov.Max = iter.ReadFloat64()
|
||||||
|
orig.Max_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|
@ -457,9 +512,14 @@ func UnmarshalProtoOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.HistogramDataPoint_Sum{}
|
var ov *otlpmetrics.HistogramDataPoint_Sum
|
||||||
ofv.Sum = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Sum_ = ofv
|
ov = &otlpmetrics.HistogramDataPoint_Sum{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Sum.Get().(*otlpmetrics.HistogramDataPoint_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = math.Float64frombits(num)
|
||||||
|
orig.Sum_ = ov
|
||||||
case 6:
|
case 6:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field BucketCounts", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field BucketCounts", wireType)
|
||||||
|
|
@ -544,9 +604,14 @@ func UnmarshalProtoOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.HistogramDataPoint_Min{}
|
var ov *otlpmetrics.HistogramDataPoint_Min
|
||||||
ofv.Min = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Min_ = ofv
|
ov = &otlpmetrics.HistogramDataPoint_Min{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Min.Get().(*otlpmetrics.HistogramDataPoint_Min)
|
||||||
|
}
|
||||||
|
ov.Min = math.Float64frombits(num)
|
||||||
|
orig.Min_ = ov
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if wireType != proto.WireTypeI64 {
|
if wireType != proto.WireTypeI64 {
|
||||||
|
|
@ -557,9 +622,14 @@ func UnmarshalProtoOrigHistogramDataPoint(orig *otlpmetrics.HistogramDataPoint,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.HistogramDataPoint_Max{}
|
var ov *otlpmetrics.HistogramDataPoint_Max
|
||||||
ofv.Max = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Max_ = ofv
|
ov = &otlpmetrics.HistogramDataPoint_Max{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolHistogramDataPoint_Max.Get().(*otlpmetrics.HistogramDataPoint_Max)
|
||||||
|
}
|
||||||
|
ov.Max = math.Float64frombits(num)
|
||||||
|
orig.Max_ = ov
|
||||||
default:
|
default:
|
||||||
pos, err = proto.ConsumeUnknown(buf, pos, wireType)
|
pos, err = proto.ConsumeUnknown(buf, pos, wireType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,13 @@ func NewInstrumentationScope(orig *otlpcommon.InstrumentationScope, state *State
|
||||||
return InstrumentationScope{orig: orig, state: state}
|
return InstrumentationScope{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolInstrumentationScope = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolInstrumentationScope = sync.Pool{
|
||||||
return &otlpcommon.InstrumentationScope{}
|
New: func() any {
|
||||||
},
|
return &otlpcommon.InstrumentationScope{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigInstrumentationScope() *otlpcommon.InstrumentationScope {
|
func NewOrigInstrumentationScope() *otlpcommon.InstrumentationScope {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolKeyValue = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolKeyValue = sync.Pool{
|
||||||
return &otlpcommon.KeyValue{}
|
New: func() any {
|
||||||
},
|
return &otlpcommon.KeyValue{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigKeyValue() *otlpcommon.KeyValue {
|
func NewOrigKeyValue() *otlpcommon.KeyValue {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolKeyValueList = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolKeyValueList = sync.Pool{
|
||||||
return &otlpcommon.KeyValueList{}
|
New: func() any {
|
||||||
},
|
return &otlpcommon.KeyValueList{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigKeyValueList() *otlpcommon.KeyValueList {
|
func NewOrigKeyValueList() *otlpcommon.KeyValueList {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolLine = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolLine = sync.Pool{
|
||||||
return &otlpprofiles.Line{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Line{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigLine() *otlpprofiles.Line {
|
func NewOrigLine() *otlpprofiles.Line {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolLink = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolLink = sync.Pool{
|
||||||
return &otlpprofiles.Link{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Link{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigLink() *otlpprofiles.Link {
|
func NewOrigLink() *otlpprofiles.Link {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,18 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolLocation = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolLocation = sync.Pool{
|
||||||
return &otlpprofiles.Location{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Location{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
protoPoolLocation_MappingIndex = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpprofiles.Location_MappingIndex{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigLocation() *otlpprofiles.Location {
|
func NewOrigLocation() *otlpprofiles.Location {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -38,6 +45,13 @@ func DeleteOrigLocation(orig *otlpprofiles.Location, nullable bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ov := orig.MappingIndex_.(type) {
|
||||||
|
case *otlpprofiles.Location_MappingIndex:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolLocation_MappingIndex.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
for i := range orig.Line {
|
for i := range orig.Line {
|
||||||
DeleteOrigLine(orig.Line[i], true)
|
DeleteOrigLine(orig.Line[i], true)
|
||||||
}
|
}
|
||||||
|
|
@ -123,9 +137,14 @@ func UnmarshalJSONOrigLocation(orig *otlpprofiles.Location, iter *json.Iterator)
|
||||||
switch f {
|
switch f {
|
||||||
case "mappingIndex", "mapping_index":
|
case "mappingIndex", "mapping_index":
|
||||||
{
|
{
|
||||||
ofm := &otlpprofiles.Location_MappingIndex{}
|
var ov *otlpprofiles.Location_MappingIndex
|
||||||
ofm.MappingIndex = iter.ReadInt32()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.MappingIndex_ = ofm
|
ov = &otlpprofiles.Location_MappingIndex{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolLocation_MappingIndex.Get().(*otlpprofiles.Location_MappingIndex)
|
||||||
|
}
|
||||||
|
ov.MappingIndex = iter.ReadInt32()
|
||||||
|
orig.MappingIndex_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "address":
|
case "address":
|
||||||
|
|
@ -245,9 +264,14 @@ func UnmarshalProtoOrigLocation(orig *otlpprofiles.Location, buf []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpprofiles.Location_MappingIndex{}
|
var ov *otlpprofiles.Location_MappingIndex
|
||||||
ofv.MappingIndex = int32(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.MappingIndex_ = ofv
|
ov = &otlpprofiles.Location_MappingIndex{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolLocation_MappingIndex.Get().(*otlpprofiles.Location_MappingIndex)
|
||||||
|
}
|
||||||
|
ov.MappingIndex = int32(num)
|
||||||
|
orig.MappingIndex_ = ov
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
if wireType != proto.WireTypeVarint {
|
if wireType != proto.WireTypeVarint {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolLogRecord = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolLogRecord = sync.Pool{
|
||||||
return &otlplogs.LogRecord{}
|
New: func() any {
|
||||||
},
|
return &otlplogs.LogRecord{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigLogRecord() *otlplogs.LogRecord {
|
func NewOrigLogRecord() *otlplogs.LogRecord {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolMapping = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolMapping = sync.Pool{
|
||||||
return &otlpprofiles.Mapping{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Mapping{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigMapping() *otlpprofiles.Mapping {
|
func NewOrigMapping() *otlpprofiles.Mapping {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,43 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolMetric = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolMetric = sync.Pool{
|
||||||
return &otlpmetrics.Metric{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Metric{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolMetric_Gauge = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Metric_Gauge{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolMetric_Sum = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Metric_Sum{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolMetric_Histogram = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Metric_Histogram{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolMetric_ExponentialHistogram = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Metric_ExponentialHistogram{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolMetric_Summary = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.Metric_Summary{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigMetric() *otlpmetrics.Metric {
|
func NewOrigMetric() *otlpmetrics.Metric {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -41,14 +73,29 @@ func DeleteOrigMetric(orig *otlpmetrics.Metric, nullable bool) {
|
||||||
|
|
||||||
switch ov := orig.Data.(type) {
|
switch ov := orig.Data.(type) {
|
||||||
case *otlpmetrics.Metric_Gauge:
|
case *otlpmetrics.Metric_Gauge:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolMetric_Gauge.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrigGauge(ov.Gauge, true)
|
DeleteOrigGauge(ov.Gauge, true)
|
||||||
case *otlpmetrics.Metric_Sum:
|
case *otlpmetrics.Metric_Sum:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolMetric_Sum.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrigSum(ov.Sum, true)
|
DeleteOrigSum(ov.Sum, true)
|
||||||
case *otlpmetrics.Metric_Histogram:
|
case *otlpmetrics.Metric_Histogram:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolMetric_Histogram.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrigHistogram(ov.Histogram, true)
|
DeleteOrigHistogram(ov.Histogram, true)
|
||||||
case *otlpmetrics.Metric_ExponentialHistogram:
|
case *otlpmetrics.Metric_ExponentialHistogram:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolMetric_ExponentialHistogram.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrigExponentialHistogram(ov.ExponentialHistogram, true)
|
DeleteOrigExponentialHistogram(ov.ExponentialHistogram, true)
|
||||||
case *otlpmetrics.Metric_Summary:
|
case *otlpmetrics.Metric_Summary:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolMetric_Summary.Put(ov)
|
||||||
|
}
|
||||||
DeleteOrigSummary(ov.Summary, true)
|
DeleteOrigSummary(ov.Summary, true)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -183,42 +230,67 @@ func UnmarshalJSONOrigMetric(orig *otlpmetrics.Metric, iter *json.Iterator) {
|
||||||
|
|
||||||
case "gauge":
|
case "gauge":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Metric_Gauge{}
|
var ov *otlpmetrics.Metric_Gauge
|
||||||
ofm.Gauge = NewOrigGauge()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrigGauge(ofm.Gauge, iter)
|
ov = &otlpmetrics.Metric_Gauge{}
|
||||||
orig.Data = ofm
|
} else {
|
||||||
|
ov = protoPoolMetric_Gauge.Get().(*otlpmetrics.Metric_Gauge)
|
||||||
|
}
|
||||||
|
ov.Gauge = NewOrigGauge()
|
||||||
|
UnmarshalJSONOrigGauge(ov.Gauge, iter)
|
||||||
|
orig.Data = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "sum":
|
case "sum":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Metric_Sum{}
|
var ov *otlpmetrics.Metric_Sum
|
||||||
ofm.Sum = NewOrigSum()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrigSum(ofm.Sum, iter)
|
ov = &otlpmetrics.Metric_Sum{}
|
||||||
orig.Data = ofm
|
} else {
|
||||||
|
ov = protoPoolMetric_Sum.Get().(*otlpmetrics.Metric_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = NewOrigSum()
|
||||||
|
UnmarshalJSONOrigSum(ov.Sum, iter)
|
||||||
|
orig.Data = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "histogram":
|
case "histogram":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Metric_Histogram{}
|
var ov *otlpmetrics.Metric_Histogram
|
||||||
ofm.Histogram = NewOrigHistogram()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrigHistogram(ofm.Histogram, iter)
|
ov = &otlpmetrics.Metric_Histogram{}
|
||||||
orig.Data = ofm
|
} else {
|
||||||
|
ov = protoPoolMetric_Histogram.Get().(*otlpmetrics.Metric_Histogram)
|
||||||
|
}
|
||||||
|
ov.Histogram = NewOrigHistogram()
|
||||||
|
UnmarshalJSONOrigHistogram(ov.Histogram, iter)
|
||||||
|
orig.Data = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "exponentialHistogram", "exponential_histogram":
|
case "exponentialHistogram", "exponential_histogram":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Metric_ExponentialHistogram{}
|
var ov *otlpmetrics.Metric_ExponentialHistogram
|
||||||
ofm.ExponentialHistogram = NewOrigExponentialHistogram()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrigExponentialHistogram(ofm.ExponentialHistogram, iter)
|
ov = &otlpmetrics.Metric_ExponentialHistogram{}
|
||||||
orig.Data = ofm
|
} else {
|
||||||
|
ov = protoPoolMetric_ExponentialHistogram.Get().(*otlpmetrics.Metric_ExponentialHistogram)
|
||||||
|
}
|
||||||
|
ov.ExponentialHistogram = NewOrigExponentialHistogram()
|
||||||
|
UnmarshalJSONOrigExponentialHistogram(ov.ExponentialHistogram, iter)
|
||||||
|
orig.Data = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "summary":
|
case "summary":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.Metric_Summary{}
|
var ov *otlpmetrics.Metric_Summary
|
||||||
ofm.Summary = NewOrigSummary()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
UnmarshalJSONOrigSummary(ofm.Summary, iter)
|
ov = &otlpmetrics.Metric_Summary{}
|
||||||
orig.Data = ofm
|
} else {
|
||||||
|
ov = protoPoolMetric_Summary.Get().(*otlpmetrics.Metric_Summary)
|
||||||
|
}
|
||||||
|
ov.Summary = NewOrigSummary()
|
||||||
|
UnmarshalJSONOrigSummary(ov.Summary, iter)
|
||||||
|
orig.Data = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "metadata":
|
case "metadata":
|
||||||
|
|
@ -414,13 +486,18 @@ func UnmarshalProtoOrigMetric(orig *otlpmetrics.Metric, buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
ofv := &otlpmetrics.Metric_Gauge{}
|
var ov *otlpmetrics.Metric_Gauge
|
||||||
ofv.Gauge = NewOrigGauge()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrigGauge(ofv.Gauge, buf[startPos:pos])
|
ov = &otlpmetrics.Metric_Gauge{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolMetric_Gauge.Get().(*otlpmetrics.Metric_Gauge)
|
||||||
|
}
|
||||||
|
ov.Gauge = NewOrigGauge()
|
||||||
|
err = UnmarshalProtoOrigGauge(ov.Gauge, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.Data = ofv
|
orig.Data = ov
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
@ -432,13 +509,18 @@ func UnmarshalProtoOrigMetric(orig *otlpmetrics.Metric, buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
ofv := &otlpmetrics.Metric_Sum{}
|
var ov *otlpmetrics.Metric_Sum
|
||||||
ofv.Sum = NewOrigSum()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrigSum(ofv.Sum, buf[startPos:pos])
|
ov = &otlpmetrics.Metric_Sum{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolMetric_Sum.Get().(*otlpmetrics.Metric_Sum)
|
||||||
|
}
|
||||||
|
ov.Sum = NewOrigSum()
|
||||||
|
err = UnmarshalProtoOrigSum(ov.Sum, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.Data = ofv
|
orig.Data = ov
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
@ -450,13 +532,18 @@ func UnmarshalProtoOrigMetric(orig *otlpmetrics.Metric, buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
ofv := &otlpmetrics.Metric_Histogram{}
|
var ov *otlpmetrics.Metric_Histogram
|
||||||
ofv.Histogram = NewOrigHistogram()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrigHistogram(ofv.Histogram, buf[startPos:pos])
|
ov = &otlpmetrics.Metric_Histogram{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolMetric_Histogram.Get().(*otlpmetrics.Metric_Histogram)
|
||||||
|
}
|
||||||
|
ov.Histogram = NewOrigHistogram()
|
||||||
|
err = UnmarshalProtoOrigHistogram(ov.Histogram, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.Data = ofv
|
orig.Data = ov
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
@ -468,13 +555,18 @@ func UnmarshalProtoOrigMetric(orig *otlpmetrics.Metric, buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
ofv := &otlpmetrics.Metric_ExponentialHistogram{}
|
var ov *otlpmetrics.Metric_ExponentialHistogram
|
||||||
ofv.ExponentialHistogram = NewOrigExponentialHistogram()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrigExponentialHistogram(ofv.ExponentialHistogram, buf[startPos:pos])
|
ov = &otlpmetrics.Metric_ExponentialHistogram{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolMetric_ExponentialHistogram.Get().(*otlpmetrics.Metric_ExponentialHistogram)
|
||||||
|
}
|
||||||
|
ov.ExponentialHistogram = NewOrigExponentialHistogram()
|
||||||
|
err = UnmarshalProtoOrigExponentialHistogram(ov.ExponentialHistogram, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.Data = ofv
|
orig.Data = ov
|
||||||
|
|
||||||
case 11:
|
case 11:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
@ -486,13 +578,18 @@ func UnmarshalProtoOrigMetric(orig *otlpmetrics.Metric, buf []byte) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
startPos := pos - length
|
startPos := pos - length
|
||||||
ofv := &otlpmetrics.Metric_Summary{}
|
var ov *otlpmetrics.Metric_Summary
|
||||||
ofv.Summary = NewOrigSummary()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
err = UnmarshalProtoOrigSummary(ofv.Summary, buf[startPos:pos])
|
ov = &otlpmetrics.Metric_Summary{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolMetric_Summary.Get().(*otlpmetrics.Metric_Summary)
|
||||||
|
}
|
||||||
|
ov.Summary = NewOrigSummary()
|
||||||
|
err = UnmarshalProtoOrigSummary(ov.Summary, buf[startPos:pos])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
orig.Data = ofv
|
orig.Data = ov
|
||||||
|
|
||||||
case 12:
|
case 12:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,25 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolNumberDataPoint = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolNumberDataPoint = sync.Pool{
|
||||||
return &otlpmetrics.NumberDataPoint{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.NumberDataPoint{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolNumberDataPoint_AsDouble = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.NumberDataPoint_AsDouble{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
protoPoolNumberDataPoint_AsInt = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpmetrics.NumberDataPoint_AsInt{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigNumberDataPoint() *otlpmetrics.NumberDataPoint {
|
func NewOrigNumberDataPoint() *otlpmetrics.NumberDataPoint {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -44,6 +58,17 @@ func DeleteOrigNumberDataPoint(orig *otlpmetrics.NumberDataPoint, nullable bool)
|
||||||
for i := range orig.Attributes {
|
for i := range orig.Attributes {
|
||||||
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
DeleteOrigKeyValue(&orig.Attributes[i], false)
|
||||||
}
|
}
|
||||||
|
switch ov := orig.Value.(type) {
|
||||||
|
case *otlpmetrics.NumberDataPoint_AsDouble:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolNumberDataPoint_AsDouble.Put(ov)
|
||||||
|
}
|
||||||
|
case *otlpmetrics.NumberDataPoint_AsInt:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolNumberDataPoint_AsInt.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
for i := range orig.Exemplars {
|
for i := range orig.Exemplars {
|
||||||
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
DeleteOrigExemplar(&orig.Exemplars[i], false)
|
||||||
}
|
}
|
||||||
|
|
@ -146,16 +171,26 @@ func UnmarshalJSONOrigNumberDataPoint(orig *otlpmetrics.NumberDataPoint, iter *j
|
||||||
|
|
||||||
case "asDouble", "as_double":
|
case "asDouble", "as_double":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.NumberDataPoint_AsDouble{}
|
var ov *otlpmetrics.NumberDataPoint_AsDouble
|
||||||
ofm.AsDouble = iter.ReadFloat64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofm
|
ov = &otlpmetrics.NumberDataPoint_AsDouble{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolNumberDataPoint_AsDouble.Get().(*otlpmetrics.NumberDataPoint_AsDouble)
|
||||||
|
}
|
||||||
|
ov.AsDouble = iter.ReadFloat64()
|
||||||
|
orig.Value = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "asInt", "as_int":
|
case "asInt", "as_int":
|
||||||
{
|
{
|
||||||
ofm := &otlpmetrics.NumberDataPoint_AsInt{}
|
var ov *otlpmetrics.NumberDataPoint_AsInt
|
||||||
ofm.AsInt = iter.ReadInt64()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofm
|
ov = &otlpmetrics.NumberDataPoint_AsInt{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolNumberDataPoint_AsInt.Get().(*otlpmetrics.NumberDataPoint_AsInt)
|
||||||
|
}
|
||||||
|
ov.AsInt = iter.ReadInt64()
|
||||||
|
orig.Value = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "exemplars":
|
case "exemplars":
|
||||||
|
|
@ -318,9 +353,14 @@ func UnmarshalProtoOrigNumberDataPoint(orig *otlpmetrics.NumberDataPoint, buf []
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.NumberDataPoint_AsDouble{}
|
var ov *otlpmetrics.NumberDataPoint_AsDouble
|
||||||
ofv.AsDouble = math.Float64frombits(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofv
|
ov = &otlpmetrics.NumberDataPoint_AsDouble{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolNumberDataPoint_AsDouble.Get().(*otlpmetrics.NumberDataPoint_AsDouble)
|
||||||
|
}
|
||||||
|
ov.AsDouble = math.Float64frombits(num)
|
||||||
|
orig.Value = ov
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
if wireType != proto.WireTypeI64 {
|
if wireType != proto.WireTypeI64 {
|
||||||
|
|
@ -331,9 +371,14 @@ func UnmarshalProtoOrigNumberDataPoint(orig *otlpmetrics.NumberDataPoint, buf []
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpmetrics.NumberDataPoint_AsInt{}
|
var ov *otlpmetrics.NumberDataPoint_AsInt
|
||||||
ofv.AsInt = int64(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.Value = ofv
|
ov = &otlpmetrics.NumberDataPoint_AsInt{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolNumberDataPoint_AsInt.Get().(*otlpmetrics.NumberDataPoint_AsInt)
|
||||||
|
}
|
||||||
|
ov.AsInt = int64(num)
|
||||||
|
orig.Value = ov
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolProfile = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolProfile = sync.Pool{
|
||||||
return &otlpprofiles.Profile{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Profile{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigProfile() *otlpprofiles.Profile {
|
func NewOrigProfile() *otlpprofiles.Profile {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -16,11 +16,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolProfilesDictionary = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolProfilesDictionary = sync.Pool{
|
||||||
return &otlpprofiles.ProfilesDictionary{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.ProfilesDictionary{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigProfilesDictionary() *otlpprofiles.ProfilesDictionary {
|
func NewOrigProfilesDictionary() *otlpprofiles.ProfilesDictionary {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,13 @@ func NewResource(orig *otlpresource.Resource, state *State) Resource {
|
||||||
return Resource{orig: orig, state: state}
|
return Resource{orig: orig, state: state}
|
||||||
}
|
}
|
||||||
|
|
||||||
var protoPoolResource = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolResource = sync.Pool{
|
||||||
return &otlpresource.Resource{}
|
New: func() any {
|
||||||
},
|
return &otlpresource.Resource{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigResource() *otlpresource.Resource {
|
func NewOrigResource() *otlpresource.Resource {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolResourceLogs = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolResourceLogs = sync.Pool{
|
||||||
return &otlplogs.ResourceLogs{}
|
New: func() any {
|
||||||
},
|
return &otlplogs.ResourceLogs{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigResourceLogs() *otlplogs.ResourceLogs {
|
func NewOrigResourceLogs() *otlplogs.ResourceLogs {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolResourceMetrics = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolResourceMetrics = sync.Pool{
|
||||||
return &otlpmetrics.ResourceMetrics{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.ResourceMetrics{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigResourceMetrics() *otlpmetrics.ResourceMetrics {
|
func NewOrigResourceMetrics() *otlpmetrics.ResourceMetrics {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolResourceProfiles = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolResourceProfiles = sync.Pool{
|
||||||
return &otlpprofiles.ResourceProfiles{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.ResourceProfiles{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigResourceProfiles() *otlpprofiles.ResourceProfiles {
|
func NewOrigResourceProfiles() *otlpprofiles.ResourceProfiles {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolResourceSpans = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolResourceSpans = sync.Pool{
|
||||||
return &otlptrace.ResourceSpans{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.ResourceSpans{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigResourceSpans() *otlptrace.ResourceSpans {
|
func NewOrigResourceSpans() *otlptrace.ResourceSpans {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,18 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSample = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSample = sync.Pool{
|
||||||
return &otlpprofiles.Sample{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.Sample{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
protoPoolSample_LinkIndex = sync.Pool{
|
||||||
|
New: func() any {
|
||||||
|
return &otlpprofiles.Sample_LinkIndex{}
|
||||||
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSample() *otlpprofiles.Sample {
|
func NewOrigSample() *otlpprofiles.Sample {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
@ -38,6 +45,14 @@ func DeleteOrigSample(orig *otlpprofiles.Sample, nullable bool) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch ov := orig.LinkIndex_.(type) {
|
||||||
|
case *otlpprofiles.Sample_LinkIndex:
|
||||||
|
if UseProtoPooling.IsEnabled() {
|
||||||
|
protoPoolSample_LinkIndex.Put(ov)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
orig.Reset()
|
orig.Reset()
|
||||||
if nullable {
|
if nullable {
|
||||||
protoPoolSample.Put(orig)
|
protoPoolSample.Put(orig)
|
||||||
|
|
@ -145,9 +160,14 @@ func UnmarshalJSONOrigSample(orig *otlpprofiles.Sample, iter *json.Iterator) {
|
||||||
|
|
||||||
case "linkIndex", "link_index":
|
case "linkIndex", "link_index":
|
||||||
{
|
{
|
||||||
ofm := &otlpprofiles.Sample_LinkIndex{}
|
var ov *otlpprofiles.Sample_LinkIndex
|
||||||
ofm.LinkIndex = iter.ReadInt32()
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.LinkIndex_ = ofm
|
ov = &otlpprofiles.Sample_LinkIndex{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolSample_LinkIndex.Get().(*otlpprofiles.Sample_LinkIndex)
|
||||||
|
}
|
||||||
|
ov.LinkIndex = iter.ReadInt32()
|
||||||
|
orig.LinkIndex_ = ov
|
||||||
}
|
}
|
||||||
|
|
||||||
case "timestampsUnixNano", "timestamps_unix_nano":
|
case "timestampsUnixNano", "timestamps_unix_nano":
|
||||||
|
|
@ -341,9 +361,14 @@ func UnmarshalProtoOrigSample(orig *otlpprofiles.Sample, buf []byte) error {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
ofv := &otlpprofiles.Sample_LinkIndex{}
|
var ov *otlpprofiles.Sample_LinkIndex
|
||||||
ofv.LinkIndex = int32(num)
|
if !UseProtoPooling.IsEnabled() {
|
||||||
orig.LinkIndex_ = ofv
|
ov = &otlpprofiles.Sample_LinkIndex{}
|
||||||
|
} else {
|
||||||
|
ov = protoPoolSample_LinkIndex.Get().(*otlpprofiles.Sample_LinkIndex)
|
||||||
|
}
|
||||||
|
ov.LinkIndex = int32(num)
|
||||||
|
orig.LinkIndex_ = ov
|
||||||
case 6:
|
case 6:
|
||||||
if wireType != proto.WireTypeLen {
|
if wireType != proto.WireTypeLen {
|
||||||
return fmt.Errorf("proto: wrong wireType = %d for field TimestampsUnixNano", wireType)
|
return fmt.Errorf("proto: wrong wireType = %d for field TimestampsUnixNano", wireType)
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolScopeLogs = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolScopeLogs = sync.Pool{
|
||||||
return &otlplogs.ScopeLogs{}
|
New: func() any {
|
||||||
},
|
return &otlplogs.ScopeLogs{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigScopeLogs() *otlplogs.ScopeLogs {
|
func NewOrigScopeLogs() *otlplogs.ScopeLogs {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolScopeMetrics = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolScopeMetrics = sync.Pool{
|
||||||
return &otlpmetrics.ScopeMetrics{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.ScopeMetrics{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigScopeMetrics() *otlpmetrics.ScopeMetrics {
|
func NewOrigScopeMetrics() *otlpmetrics.ScopeMetrics {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolScopeProfiles = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolScopeProfiles = sync.Pool{
|
||||||
return &otlpprofiles.ScopeProfiles{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.ScopeProfiles{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigScopeProfiles() *otlpprofiles.ScopeProfiles {
|
func NewOrigScopeProfiles() *otlpprofiles.ScopeProfiles {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolScopeSpans = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolScopeSpans = sync.Pool{
|
||||||
return &otlptrace.ScopeSpans{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.ScopeSpans{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigScopeSpans() *otlptrace.ScopeSpans {
|
func NewOrigScopeSpans() *otlptrace.ScopeSpans {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSpan = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSpan = sync.Pool{
|
||||||
return &otlptrace.Span{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.Span{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSpan() *otlptrace.Span {
|
func NewOrigSpan() *otlptrace.Span {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSpan_Event = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSpan_Event = sync.Pool{
|
||||||
return &otlptrace.Span_Event{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.Span_Event{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSpan_Event() *otlptrace.Span_Event {
|
func NewOrigSpan_Event() *otlptrace.Span_Event {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSpan_Link = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSpan_Link = sync.Pool{
|
||||||
return &otlptrace.Span_Link{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.Span_Link{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSpan_Link() *otlptrace.Span_Link {
|
func NewOrigSpan_Link() *otlptrace.Span_Link {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolStatus = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolStatus = sync.Pool{
|
||||||
return &otlptrace.Status{}
|
New: func() any {
|
||||||
},
|
return &otlptrace.Status{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigStatus() *otlptrace.Status {
|
func NewOrigStatus() *otlptrace.Status {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSum = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSum = sync.Pool{
|
||||||
return &otlpmetrics.Sum{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Sum{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSum() *otlpmetrics.Sum {
|
func NewOrigSum() *otlpmetrics.Sum {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSummary = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSummary = sync.Pool{
|
||||||
return &otlpmetrics.Summary{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.Summary{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSummary() *otlpmetrics.Summary {
|
func NewOrigSummary() *otlpmetrics.Summary {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -18,11 +18,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSummaryDataPoint = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSummaryDataPoint = sync.Pool{
|
||||||
return &otlpmetrics.SummaryDataPoint{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.SummaryDataPoint{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSummaryDataPoint() *otlpmetrics.SummaryDataPoint {
|
func NewOrigSummaryDataPoint() *otlpmetrics.SummaryDataPoint {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolSummaryDataPoint_ValueAtQuantile = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolSummaryDataPoint_ValueAtQuantile = sync.Pool{
|
||||||
return &otlpmetrics.SummaryDataPoint_ValueAtQuantile{}
|
New: func() any {
|
||||||
},
|
return &otlpmetrics.SummaryDataPoint_ValueAtQuantile{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigSummaryDataPoint_ValueAtQuantile() *otlpmetrics.SummaryDataPoint_ValueAtQuantile {
|
func NewOrigSummaryDataPoint_ValueAtQuantile() *otlpmetrics.SummaryDataPoint_ValueAtQuantile {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,13 @@ import (
|
||||||
"go.opentelemetry.io/collector/pdata/internal/proto"
|
"go.opentelemetry.io/collector/pdata/internal/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
var protoPoolValueType = sync.Pool{
|
var (
|
||||||
New: func() any {
|
protoPoolValueType = sync.Pool{
|
||||||
return &otlpprofiles.ValueType{}
|
New: func() any {
|
||||||
},
|
return &otlpprofiles.ValueType{}
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
func NewOrigValueType() *otlpprofiles.ValueType {
|
func NewOrigValueType() *otlpprofiles.ValueType {
|
||||||
if !UseProtoPooling.IsEnabled() {
|
if !UseProtoPooling.IsEnabled() {
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ func TestReadKvlistValueInvalidArrayValue(t *testing.T) {
|
||||||
func TestCopyOrigAnyValueAllTypes(t *testing.T) {
|
func TestCopyOrigAnyValueAllTypes(t *testing.T) {
|
||||||
for name, src := range allAnyValues() {
|
for name, src := range allAnyValues() {
|
||||||
for _, pooling := range []bool{true, false} {
|
for _, pooling := range []bool{true, false} {
|
||||||
t.Run(name+"pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
t.Run(name+"/pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
||||||
prevPooling := UseProtoPooling.IsEnabled()
|
prevPooling := UseProtoPooling.IsEnabled()
|
||||||
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
@ -87,7 +87,7 @@ func TestCopyOrigAnyValueAllTypes(t *testing.T) {
|
||||||
func TestMarshalAndUnmarshalJSONOrigAnyValue(t *testing.T) {
|
func TestMarshalAndUnmarshalJSONOrigAnyValue(t *testing.T) {
|
||||||
for name, src := range allAnyValues() {
|
for name, src := range allAnyValues() {
|
||||||
for _, pooling := range []bool{true, false} {
|
for _, pooling := range []bool{true, false} {
|
||||||
t.Run(name+"pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
t.Run(name+"/pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
||||||
prevPooling := UseProtoPooling.IsEnabled()
|
prevPooling := UseProtoPooling.IsEnabled()
|
||||||
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
@ -131,7 +131,7 @@ func TestMarshalAndUnmarshalProtoOrigAnyValueFailing(t *testing.T) {
|
||||||
func TestMarshalAndUnmarshalProtoAnyValue(t *testing.T) {
|
func TestMarshalAndUnmarshalProtoAnyValue(t *testing.T) {
|
||||||
for name, src := range allAnyValues() {
|
for name, src := range allAnyValues() {
|
||||||
for _, pooling := range []bool{true, false} {
|
for _, pooling := range []bool{true, false} {
|
||||||
t.Run(name+"pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
t.Run(name+"/pooling_"+strconv.FormatBool(pooling), func(t *testing.T) {
|
||||||
prevPooling := UseProtoPooling.IsEnabled()
|
prevPooling := UseProtoPooling.IsEnabled()
|
||||||
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
require.NoError(t, featuregate.GlobalRegistry().Set(UseProtoPooling.ID(), pooling))
|
||||||
defer func() {
|
defer func() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue