Skip to content

Commit

Permalink
add application log group info for AppSignals (#1018)
Browse files Browse the repository at this point in the history
  • Loading branch information
pxaws authored Jan 30, 2024
1 parent fe3013d commit f2caf17
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -685,6 +685,12 @@ func (h *kubernetesHostedInAttributeResolver) Process(attributes, resourceAttrib
attributes.PutStr(attr.HostedInClusterNameK8s, h.clusterName)
}

//The application log group in Container Insights is a fixed pattern:
// "/aws/containerinsights/{Cluster_Name}/application"
// See https://github.com/aws/amazon-cloudwatch-agent-operator/blob/fe144bb02d7b1930715aa3ea32e57a5ff13406aa/helm/templates/fluent-bit-configmap.yaml#L82
logGroupName := "/aws/containerinsights/" + h.clusterName + "/application"
resourceAttributes.PutStr(semconv.AttributeAWSLogGroupNames, logGroupName)

return nil
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
mapset "github.com/deckarep/golang-set/v2"
"github.com/stretchr/testify/assert"
"go.opentelemetry.io/collector/pdata/pcommon"
semconv "go.opentelemetry.io/collector/semconv/v1.17.0"
"go.uber.org/zap"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -838,6 +839,7 @@ func TestHostedInEksResolver(t *testing.T) {
assert.NoError(t, err)
assert.Equal(t, "test-namespace-3", getStrAttr(attributes, attr.HostedInK8SNamespace, t))
assert.Equal(t, "test-cluster", getStrAttr(attributes, attr.HostedInClusterNameEKS, t))
assert.Equal(t, "/aws/containerinsights/test-cluster/application", getStrAttr(resourceAttributes, semconv.AttributeAWSLogGroupNames, t))
}

func TestExtractIPPort(t *testing.T) {
Expand Down

0 comments on commit f2caf17

Please sign in to comment.