Skip to content

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

Merged

Conversation

codeboten
Copy link
Contributor

Description:
As per issue #3926, adding NewAttributeMapFromMap for consistency. As part of this also deprecating the existing InitFromMap will will be removed once the contrib repo is updated.

Link to tracking Issue: part of #3926

Testing: Updated existing tests

@codeboten codeboten requested review from a team and bogdandrutu August 30, 2021 21:48
@@ -38,41 +38,41 @@ const (
)

func initResourceAttributes1(dest pdata.AttributeMap) {
dest.InitFromMap(resourceAttributes1)
pdata.NewAttributeMapFromMap(resourceAttributes1).CopyTo(dest)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A simple "UpsertString"?

Copy link
Member

@bogdandrutu bogdandrutu left a 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

@bogdandrutu bogdandrutu merged commit 35987d0 into open-telemetry:main Aug 31, 2021
bogdandrutu pushed a commit that referenced this pull request Aug 31, 2021
* updates from feedback

* use InsertString instead
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants