-
Notifications
You must be signed in to change notification settings - Fork 1.6k
add NewAttributeMapFromMap, mark InitFromMap deprecated #3936
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add NewAttributeMapFromMap, mark InitFromMap deprecated #3936
Conversation
@@ -38,41 +38,41 @@ const ( | |||
) | |||
|
|||
func initResourceAttributes1(dest pdata.AttributeMap) { | |||
dest.InitFromMap(resourceAttributes1) | |||
pdata.NewAttributeMapFromMap(resourceAttributes1).CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we can make the resourceAttributes1 to be AttributesMap, separate PR I am ok, but just an issue?
} | ||
|
||
func initMetricAttachment(dest pdata.AttributeMap) { | ||
dest.InitFromMap(map[string]pdata.AttributeValue{TestAttachmentKey: pdata.NewAttributeValueString(TestAttachmentValue)}) | ||
pdata.NewAttributeMapFromMap(map[string]pdata.AttributeValue{TestAttachmentKey: pdata.NewAttributeValueString(TestAttachmentValue)}).CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple "UpsertString"?
} | ||
|
||
func initMetricAttributes1(dest pdata.AttributeMap) { | ||
dest.InitFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1)}) | ||
pdata.NewAttributeMapFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1)}).CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple "UpsertString"?
} | ||
|
||
func initMetricAttributes12(dest pdata.AttributeMap) { | ||
dest.InitFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1), TestLabelKey2: pdata.NewAttributeValueString(TestLabelValue2)}).Sort() | ||
pdata.NewAttributeMapFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1), TestLabelKey2: pdata.NewAttributeValueString(TestLabelValue2)}).Sort().CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two simple "UpsertString"?
} | ||
|
||
func initMetricAttributes13(dest pdata.AttributeMap) { | ||
dest.InitFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1), TestLabelKey3: pdata.NewAttributeValueString(TestLabelValue3)}).Sort() | ||
pdata.NewAttributeMapFromMap(map[string]pdata.AttributeValue{TestLabelKey1: pdata.NewAttributeValueString(TestLabelValue1), TestLabelKey3: pdata.NewAttributeValueString(TestLabelValue3)}).Sort().CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Two simple "UpsertString"?
} | ||
|
||
func initMetricAttributes2(dest pdata.AttributeMap) { | ||
dest.InitFromMap(map[string]pdata.AttributeValue{TestLabelKey2: pdata.NewAttributeValueString(TestLabelValue2)}) | ||
pdata.NewAttributeMapFromMap(map[string]pdata.AttributeValue{TestLabelKey2: pdata.NewAttributeValueString(TestLabelValue2)}).CopyTo(dest) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A simple "UpsertString"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's merge this before the release, and deal with the comments in a follow-up
Description:
As per issue #3926, adding
NewAttributeMapFromMap
for consistency. As part of this also deprecating the existingInitFromMap
will will be removed once the contrib repo is updated.Link to tracking Issue: part of #3926
Testing: Updated existing tests