-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CWS] fix task tags in fargate (#29666)
- Loading branch information
Showing
5 changed files
with
103 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build docker | ||
|
||
// Package module holds module related files | ||
package module | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
ecsmeta "github.com/DataDog/datadog-agent/pkg/util/ecs/metadata" | ||
) | ||
|
||
func getCurrentECSTaskTags() (map[string]string, error) { | ||
client, err := ecsmeta.V3orV4FromCurrentTask() | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
ctx, cancel := context.WithTimeout(context.Background(), time.Duration(5*time.Second)) | ||
defer cancel() | ||
|
||
task, err := client.GetTask(ctx) | ||
if err != nil { | ||
return nil, err | ||
} | ||
|
||
return map[string]string{ | ||
"task_name": task.Family, | ||
"task_family": task.Family, | ||
"task_arn": task.TaskARN, | ||
"task_version": task.Version, | ||
}, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016-present Datadog, Inc. | ||
|
||
//go:build !docker | ||
|
||
// Package module holds module related files | ||
package module | ||
|
||
func getCurrentECSTaskTags() (map[string]string, error) { | ||
return nil, nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters