Skip to content

Commit

Permalink
rest of the changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Lulu413 committed May 16, 2024
1 parent a46ffae commit a8f060a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 7 deletions.
21 changes: 14 additions & 7 deletions enricher/ecs/ecs.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ import (

type Enricher struct {
canvaAWSAccount string
canvaAppId string
canvaAppName string
canvaComponent string
logGroup string
ecsTaskFamily string
ecsTaskRevision int
Expand Down Expand Up @@ -45,7 +47,9 @@ func NewEnricher() *Enricher {

return &Enricher{
canvaAWSAccount: os.Getenv("CANVA_AWS_ACCOUNT"),
canvaAppId: os.Getenv("CANVA_APP_ID"),
canvaAppName: os.Getenv("CANVA_APP_NAME"),
canvaComponent: os.Getenv("CANVA_COMPONENT"),
logGroup: os.Getenv("LOG_GROUP"),
ecsTaskFamily: ecsTaskFamily,
ecsTaskRevision: ecsTaskRevision,
Expand All @@ -55,13 +59,16 @@ func NewEnricher() *Enricher {
// EnrichRecord modifies existing record.
func (enr *Enricher) EnrichRecord(r map[interface{}]interface{}, t time.Time) map[interface{}]interface{} {
resource := map[interface{}]interface{}{
mappings.RESOURCE_ACCOUNT_ID: enr.canvaAWSAccount,
"service.name": enr.canvaAppName,
"cloud.platform": "aws_ecs",
"aws.ecs.launchtype": "EC2",
"aws.ecs.task.family": enr.ecsTaskFamily,
"aws.ecs.task.revision": enr.ecsTaskRevision,
"aws.log.group.names": enr.logGroup,
mappings.RESOURCE_ACCOUNT_ID: enr.canvaAWSAccount,
mappings.RESOURCE_APPLICATION_ID: enr.canvaAppId,
mappings.RESOURCE_COMPONENT: enr.canvaComponent,
mappings.RESOURCE_SERVICE_NAME: enr.canvaAppName,
"service.name": enr.canvaAppName,

Check failure on line 66 in enricher/ecs/ecs.go

View workflow job for this annotation

GitHub Actions / Build

duplicate key "service.name" in map literal
"cloud.platform": "aws_ecs",
"aws.ecs.launchtype": "EC2",
"aws.ecs.task.family": enr.ecsTaskFamily,
"aws.ecs.task.revision": enr.ecsTaskRevision,
"aws.log.group.names": enr.logGroup,
}
body := make(map[interface{}]interface{})

Expand Down
1 change: 1 addition & 0 deletions enricher/mappings/mappings.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const (
RESOURCE_ORGANIZATION = "organization"
RESOURCE_PLATFORM = "cloud.platform"
RESOURCE_PROVIDER = "cloud.provider"
RESOURCE_COMPONENT = "component"
)

const (
Expand Down

0 comments on commit a8f060a

Please sign in to comment.