Skip to content

Commit

Permalink
Merge branch 'main' into remove-dbmodel
Browse files Browse the repository at this point in the history
  • Loading branch information
yurishkuro authored Jan 3, 2025
2 parents a045394 + 5f85b54 commit 73a05dd
Show file tree
Hide file tree
Showing 49 changed files with 907 additions and 680 deletions.
27 changes: 27 additions & 0 deletions .chloggen/aws-xray-exporter-merge-in-latest-semconv.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: enhancement

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: awsxrayexporter

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: merge in latest semantic conventions for awsxrayexporter.

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36894]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
27 changes: 27 additions & 0 deletions .chloggen/mongodbatlas-default-transport.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Use this changelog template to create an entry for release notes.

# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
change_type: bug_fix

# The name of the component, or a single word describing the area of concern, (e.g. filelogreceiver)
component: mongodbatlasreceiver

# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
note: Update the mongoDB Atlas receiver to use the Default HTTP Transport that supports default proxy configuration

# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
issues: [36412]

# (Optional) One or more lines of additional information to render under the primary note.
# These lines will be padded with 2 spaces and then inserted directly into the document.
# Use pipe (|) for multiline entries.
subtext:

# If your change doesn't affect end users or the exported elements of any package,
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
# Optional: The change log or logs in which this entry should be included.
# e.g. '[user]' or '[user, api]'
# Include 'user' if the change is relevant to end users.
# Include 'api' if there is a change to a library API.
# Default: '[user]'
change_logs: [user]
2 changes: 1 addition & 1 deletion connector/datadogconnector/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ require (
github.com/rs/cors v1.11.1 // indirect
github.com/secure-systems-lab/go-securesystemslib v0.7.0 // indirect
github.com/shirou/gopsutil/v3 v3.24.5 // indirect
github.com/shirou/gopsutil/v4 v4.24.11 // indirect
github.com/shirou/gopsutil/v4 v4.24.12 // indirect
github.com/shoenig/go-m1cpu v0.1.6 // indirect
github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cast v1.7.0 // indirect
Expand Down
4 changes: 2 additions & 2 deletions connector/datadogconnector/go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 16 additions & 16 deletions exporter/awsxrayexporter/awsxray_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import (
"go.opentelemetry.io/collector/exporter/exportertest"
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/ptrace"
conventions "go.opentelemetry.io/collector/semconv/v1.12.0"
conventionsv112 "go.opentelemetry.io/collector/semconv/v1.12.0"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/awsutil"
Expand Down Expand Up @@ -172,22 +172,22 @@ func constructW3CFormatTraceSpanData(ispans ptrace.ScopeSpans) {
func constructResource() pcommon.Resource {
resource := pcommon.NewResource()
attrs := resource.Attributes()
attrs.PutStr(conventions.AttributeServiceName, "signup_aggregator")
attrs.PutStr(conventions.AttributeContainerName, "signup_aggregator")
attrs.PutStr(conventions.AttributeContainerImageName, "otel/signupaggregator")
attrs.PutStr(conventions.AttributeContainerImageTag, "v1")
attrs.PutStr(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
attrs.PutStr(conventions.AttributeCloudAccountID, "999999998")
attrs.PutStr(conventions.AttributeCloudRegion, "us-west-2")
attrs.PutStr(conventions.AttributeCloudAvailabilityZone, "us-west-1b")
attrs.PutStr(conventionsv112.AttributeServiceName, "signup_aggregator")
attrs.PutStr(conventionsv112.AttributeContainerName, "signup_aggregator")
attrs.PutStr(conventionsv112.AttributeContainerImageName, "otel/signupaggregator")
attrs.PutStr(conventionsv112.AttributeContainerImageTag, "v1")
attrs.PutStr(conventionsv112.AttributeCloudProvider, conventionsv112.AttributeCloudProviderAWS)
attrs.PutStr(conventionsv112.AttributeCloudAccountID, "999999998")
attrs.PutStr(conventionsv112.AttributeCloudRegion, "us-west-2")
attrs.PutStr(conventionsv112.AttributeCloudAvailabilityZone, "us-west-1b")
return resource
}

func constructHTTPClientSpan(traceID pcommon.TraceID) ptrace.Span {
attributes := make(map[string]any)
attributes[conventions.AttributeHTTPMethod] = http.MethodGet
attributes[conventions.AttributeHTTPURL] = "https://api.example.com/users/junit"
attributes[conventions.AttributeHTTPStatusCode] = 200
attributes[conventionsv112.AttributeHTTPMethod] = http.MethodGet
attributes[conventionsv112.AttributeHTTPURL] = "https://api.example.com/users/junit"
attributes[conventionsv112.AttributeHTTPStatusCode] = 200
endTime := time.Now().Round(time.Second)
startTime := endTime.Add(-90 * time.Second)
spanAttributes := constructSpanAttributes(attributes)
Expand All @@ -212,10 +212,10 @@ func constructHTTPClientSpan(traceID pcommon.TraceID) ptrace.Span {

func constructHTTPServerSpan(traceID pcommon.TraceID) ptrace.Span {
attributes := make(map[string]any)
attributes[conventions.AttributeHTTPMethod] = http.MethodGet
attributes[conventions.AttributeHTTPURL] = "https://api.example.com/users/junit"
attributes[conventions.AttributeHTTPClientIP] = "192.168.15.32"
attributes[conventions.AttributeHTTPStatusCode] = 200
attributes[conventionsv112.AttributeHTTPMethod] = http.MethodGet
attributes[conventionsv112.AttributeHTTPURL] = "https://api.example.com/users/junit"
attributes[conventionsv112.AttributeHTTPClientIP] = "192.168.15.32"
attributes[conventionsv112.AttributeHTTPStatusCode] = 200
endTime := time.Now().Round(time.Second)
startTime := endTime.Add(-90 * time.Second)
spanAttributes := constructSpanAttributes(attributes)
Expand Down
73 changes: 37 additions & 36 deletions exporter/awsxrayexporter/internal/translator/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import (

"github.com/aws/aws-sdk-go/aws"
"go.opentelemetry.io/collector/pdata/pcommon"
conventions "go.opentelemetry.io/collector/semconv/v1.12.0"
conventionsv112 "go.opentelemetry.io/collector/semconv/v1.12.0"
conventions "go.opentelemetry.io/collector/semconv/v1.27.0"

awsxray "github.com/open-telemetry/opentelemetry-collector-contrib/internal/aws/xray"
)
Expand Down Expand Up @@ -58,71 +59,71 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
filtered := make(map[string]pcommon.Value)
resource.Attributes().Range(func(key string, value pcommon.Value) bool {
switch key {
case conventions.AttributeCloudProvider:
case conventionsv112.AttributeCloudProvider:
cloud = value.Str()
case conventions.AttributeCloudPlatform:
case conventionsv112.AttributeCloudPlatform:
service = value.Str()
case conventions.AttributeCloudAccountID:
case conventionsv112.AttributeCloudAccountID:
account = value.Str()
case conventions.AttributeCloudAvailabilityZone:
case conventionsv112.AttributeCloudAvailabilityZone:
zone = value.Str()
case conventions.AttributeHostID:
case conventionsv112.AttributeHostID:
hostID = value.Str()
case conventions.AttributeHostType:
case conventionsv112.AttributeHostType:
hostType = value.Str()
case conventions.AttributeHostImageID:
case conventionsv112.AttributeHostImageID:
amiID = value.Str()
case conventions.AttributeContainerName:
case conventionsv112.AttributeContainerName:
if container == "" {
container = value.Str()
}
case conventions.AttributeK8SPodName:
case conventionsv112.AttributeK8SPodName:
podUID = value.Str()
case conventions.AttributeServiceNamespace:
case conventionsv112.AttributeServiceNamespace:
namespace = value.Str()
case conventions.AttributeServiceInstanceID:
case conventionsv112.AttributeServiceInstanceID:
deployID = value.Str()
case conventions.AttributeServiceVersion:
case conventionsv112.AttributeServiceVersion:
versionLabel = value.Str()
case conventions.AttributeTelemetrySDKName:
case conventionsv112.AttributeTelemetrySDKName:
sdkName = value.Str()
case conventions.AttributeTelemetrySDKLanguage:
case conventionsv112.AttributeTelemetrySDKLanguage:
sdkLanguage = value.Str()
case conventions.AttributeTelemetrySDKVersion:
case conventionsv112.AttributeTelemetrySDKVersion:
sdkVersion = value.Str()
case conventions.AttributeTelemetryAutoVersion:
case conventionsv112.AttributeTelemetryAutoVersion, conventions.AttributeTelemetryDistroVersion:
autoVersion = value.Str()
case conventions.AttributeContainerID:
case conventionsv112.AttributeContainerID:
containerID = value.Str()
case conventions.AttributeK8SClusterName:
case conventionsv112.AttributeK8SClusterName:
clusterName = value.Str()
case conventions.AttributeAWSECSClusterARN:
case conventionsv112.AttributeAWSECSClusterARN:
clusterArn = value.Str()
case conventions.AttributeAWSECSContainerARN:
case conventionsv112.AttributeAWSECSContainerARN:
containerArn = value.Str()
case conventions.AttributeAWSECSTaskARN:
case conventionsv112.AttributeAWSECSTaskARN:
taskArn = value.Str()
case conventions.AttributeAWSECSTaskFamily:
case conventionsv112.AttributeAWSECSTaskFamily:
taskFamily = value.Str()
case conventions.AttributeAWSECSLaunchtype:
case conventionsv112.AttributeAWSECSLaunchtype:
launchType = value.Str()
case conventions.AttributeAWSLogGroupNames:
case conventionsv112.AttributeAWSLogGroupNames:
logGroups = normalizeToSlice(value)
case conventions.AttributeAWSLogGroupARNs:
case conventionsv112.AttributeAWSLogGroupARNs:
logGroupArns = normalizeToSlice(value)
}
return true
})

if awsOperation, ok := attributes[awsxray.AWSOperationAttribute]; ok {
operation = awsOperation.Str()
} else if rpcMethod, ok := attributes[conventions.AttributeRPCMethod]; ok {
} else if rpcMethod, ok := attributes[conventionsv112.AttributeRPCMethod]; ok {
operation = rpcMethod.Str()
}

for key, value := range attributes {
switch key {
case conventions.AttributeRPCMethod:
case conventionsv112.AttributeRPCMethod:
// Determinstically handled with if else above
case awsxray.AWSOperationAttribute:
// Determinstically handled with if else above
Expand All @@ -148,15 +149,15 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
filtered[key] = value
}
}
if cloud != conventions.AttributeCloudProviderAWS && cloud != "" {
if cloud != conventionsv112.AttributeCloudProviderAWS && cloud != "" {
return filtered, nil // not AWS so return nil
}

// Favor Semantic Conventions for specific SQS and DynamoDB attributes.
if value, ok := attributes[conventions.AttributeMessagingURL]; ok {
if value, ok := attributes[conventionsv112.AttributeMessagingURL]; ok {
queueURL = value.Str()
}
if value, ok := attributes[conventions.AttributeAWSDynamoDBTableNames]; ok {
if value, ok := attributes[conventionsv112.AttributeAWSDynamoDBTableNames]; ok {
switch value.Type() {
case pcommon.ValueTypeSlice:
if value.Slice().Len() == 1 {
Expand All @@ -176,7 +177,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
// EC2 - add ec2 metadata to xray request if
// 1. cloud.platfrom is set to "aws_ec2" or
// 2. there is an non-blank host/instance id found
if service == conventions.AttributeCloudPlatformAWSEC2 || hostID != "" {
if service == conventionsv112.AttributeCloudPlatformAWSEC2 || hostID != "" {
ec2 = &awsxray.EC2Metadata{
InstanceID: awsxray.String(hostID),
AvailabilityZone: awsxray.String(zone),
Expand All @@ -186,7 +187,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
}

// ECS
if service == conventions.AttributeCloudPlatformAWSECS {
if service == conventionsv112.AttributeCloudPlatformAWSECS {
ecs = &awsxray.ECSMetadata{
ContainerName: awsxray.String(container),
ContainerID: awsxray.String(containerID),
Expand All @@ -200,7 +201,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
}

// Beanstalk
if service == conventions.AttributeCloudPlatformAWSElasticBeanstalk && deployID != "" {
if service == conventionsv112.AttributeCloudPlatformAWSElasticBeanstalk && deployID != "" {
deployNum, err := strconv.ParseInt(deployID, 10, 64)
if err != nil {
deployNum = 0
Expand All @@ -213,7 +214,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log
}

// EKS or native Kubernetes
if service == conventions.AttributeCloudPlatformAWSEKS || clusterName != "" {
if service == conventionsv112.AttributeCloudPlatformAWSEKS || clusterName != "" {
eks = &awsxray.EKSMetadata{
ClusterName: awsxray.String(clusterName),
Pod: awsxray.String(podUID),
Expand Down Expand Up @@ -242,7 +243,7 @@ func makeAws(attributes map[string]pcommon.Value, resource pcommon.Resource, log

if sdkName != "" && sdkLanguage != "" {
// Convention for SDK name for xray SDK information is e.g., `X-Ray SDK for Java`, `X-Ray for Go`.
// We fill in with e.g, `opentelemetry for java` by using the conventions
// We fill in with e.g, `opentelemetry for java` by using the conventionsv112
sdk = sdkName + " for " + sdkLanguage
} else {
sdk = sdkName
Expand Down
Loading

0 comments on commit 73a05dd

Please sign in to comment.