Skip to content

Commit

Permalink
[chore] Remove redundant Attribute part from internal pdata helpers (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitryax authored Sep 29, 2022
1 parent 7740c7b commit 87265bd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pdata/pcommon/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -590,28 +590,28 @@ func (v Value) AsRaw() interface{} {
return fmt.Sprintf("<Unknown OpenTelemetry value type %q>", v.Type())
}

func newAttributeKeyValueString(k string, v string) otlpcommon.KeyValue {
func newKeyValueString(k string, v string) otlpcommon.KeyValue {
orig := otlpcommon.KeyValue{Key: k}
akv := newValue(&orig.Value)
akv.SetStr(v)
return orig
}

func newAttributeKeyValueInt(k string, v int64) otlpcommon.KeyValue {
func newKeyValueInt(k string, v int64) otlpcommon.KeyValue {
orig := otlpcommon.KeyValue{Key: k}
akv := newValue(&orig.Value)
akv.SetInt(v)
return orig
}

func newAttributeKeyValueDouble(k string, v float64) otlpcommon.KeyValue {
func newKeyValueDouble(k string, v float64) otlpcommon.KeyValue {
orig := otlpcommon.KeyValue{Key: k}
akv := newValue(&orig.Value)
akv.SetDouble(v)
return orig
}

func newAttributeKeyValueBool(k string, v bool) otlpcommon.KeyValue {
func newKeyValueBool(k string, v bool) otlpcommon.KeyValue {
orig := otlpcommon.KeyValue{Key: k}
akv := newValue(&orig.Value)
akv.SetBool(v)
Expand Down Expand Up @@ -719,7 +719,7 @@ func (m Map) PutString(k string, v string) {
if av, existing := m.Get(k); existing {
av.SetStr(v)
} else {
*m.getOrig() = append(*m.getOrig(), newAttributeKeyValueString(k, v))
*m.getOrig() = append(*m.getOrig(), newKeyValueString(k, v))
}
}

Expand All @@ -730,7 +730,7 @@ func (m Map) PutInt(k string, v int64) {
if av, existing := m.Get(k); existing {
av.SetInt(v)
} else {
*m.getOrig() = append(*m.getOrig(), newAttributeKeyValueInt(k, v))
*m.getOrig() = append(*m.getOrig(), newKeyValueInt(k, v))
}
}

Expand All @@ -741,7 +741,7 @@ func (m Map) PutDouble(k string, v float64) {
if av, existing := m.Get(k); existing {
av.SetDouble(v)
} else {
*m.getOrig() = append(*m.getOrig(), newAttributeKeyValueDouble(k, v))
*m.getOrig() = append(*m.getOrig(), newKeyValueDouble(k, v))
}
}

Expand All @@ -752,7 +752,7 @@ func (m Map) PutBool(k string, v bool) {
if av, existing := m.Get(k); existing {
av.SetBool(v)
} else {
*m.getOrig() = append(*m.getOrig(), newAttributeKeyValueBool(k, v))
*m.getOrig() = append(*m.getOrig(), newKeyValueBool(k, v))
}
}

Expand Down

0 comments on commit 87265bd

Please sign in to comment.