Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Refactor DBUser attribute #1245

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion plugins/processors/awsapplicationsignals/common/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ const (
MetricAttributeRemoteOperation = "RemoteOperation"
MetricAttributeRemoteResourceIdentifier = "RemoteResourceIdentifier"
MetricAttributeRemoteResourceType = "RemoteResourceType"
MetricAttributeRemoteDbUser = "RemoteDbUser"
)

const (
Expand All @@ -23,6 +22,7 @@ const (
AttributeEC2InstanceId = "EC2.InstanceId"
AttributeHost = "Host"
AttributePlatformType = "PlatformType"
AttributeRemoteDbUser = "RemoteDbUser"
AttributeTelemetrySDK = "Telemetry.SDK"
AttributeTelemetryAgent = "Telemetry.Agent"
AttributeTelemetrySource = "Telemetry.Source"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ type attributesNormalizer struct {
logger *zap.Logger
}

var attributesRenaming = map[string]string{
attr.AWSRemoteDbUser: common.AttributeRemoteDbUser,
}

var attributesRenamingForMetric = map[string]string{
attr.AWSLocalService: common.MetricAttributeLocalService,
attr.AWSLocalOperation: common.MetricAttributeLocalOperation,
Expand All @@ -40,7 +44,6 @@ var attributesRenamingForMetric = map[string]string{
attr.AWSRemoteTarget: common.MetricAttributeRemoteResourceIdentifier,
attr.AWSRemoteResourceIdentifier: common.MetricAttributeRemoteResourceIdentifier,
attr.AWSRemoteResourceType: common.MetricAttributeRemoteResourceType,
attr.AWSRemoteDbUser: common.MetricAttributeRemoteDbUser,
Copy link
Collaborator

Choose a reason for hiding this comment

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

attributesRenamingForMetric is created to maintain the list of attributes to be renamed for attributes in EMF logs, so keeping AttributeRemoteDbUser here is ok. But now I see how much confusion it caused from the current naming.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In that case, I'll close this pull request if it's fine with you?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes. Thank you!

}

var resourceAttributesRenamingForTrace = map[string]string{
Expand Down Expand Up @@ -98,6 +101,7 @@ func (n *attributesNormalizer) renameAttributes(attributes, resourceAttributes p
rename(resourceAttributes, resourceAttributesRenamingForTrace)
rename(attributes, attributesRenamingForTrace)
} else {
rename(attributes, attributesRenaming)
rename(attributes, attributesRenamingForMetric)
}
}
Expand Down