Skip to content

Commit

Permalink
Add middleware.io specific resource attributes for cloudwatchreceiver
Browse files Browse the repository at this point in the history
  • Loading branch information
tejaskokje-mw committed Jun 10, 2024
1 parent 2890636 commit 444d8f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions receiver/awscloudwatchreceiver/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ require (
go.opentelemetry.io/collector/consumer v0.84.0
go.opentelemetry.io/collector/pdata v1.0.0-rcv0014
go.opentelemetry.io/collector/receiver v0.84.0
go.opentelemetry.io/collector/semconv v0.84.0
go.uber.org/zap v1.25.0
)

Expand Down
2 changes: 2 additions & 0 deletions receiver/awscloudwatchreceiver/go.sum

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

10 changes: 9 additions & 1 deletion receiver/awscloudwatchreceiver/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ import (
"go.opentelemetry.io/collector/pdata/pcommon"
"go.opentelemetry.io/collector/pdata/plog"
"go.uber.org/zap"

conventions "go.opentelemetry.io/collector/semconv/v1.6.1"
)

const (
Expand Down Expand Up @@ -275,9 +277,15 @@ func (l *logsReceiver) processEvents(now pcommon.Timestamp, logGroupName string,
rl := logs.ResourceLogs().AppendEmpty()
resourceLogs = &rl
resourceAttributes := resourceLogs.Resource().Attributes()
resourceAttributes.PutStr("aws.region", l.region)
resourceAttributes.PutStr(conventions.AttributeCloudProvider, conventions.AttributeCloudProviderAWS)
resourceAttributes.PutStr(conventions.AttributeCloudRegion, l.region)
resourceAttributes.PutStr("cloudwatch.log.group.name", logGroupName)
resourceAttributes.PutStr("cloudwatch.log.stream", logStreamName)

//middleware.io specific attributes
resourceAttributes.PutStr("channel", conventions.AttributeCloudProviderAWS)
resourceAttributes.PutStr("aws.scraping_approach", "api_polling")
resourceAttributes.PutStr("aws.polling_approach", l.pollingApproach)
group[logStreamName] = resourceLogs

// Ensure one scopeLogs is initialized so we can handle in standardized way going forward.
Expand Down

0 comments on commit 444d8f9

Please sign in to comment.