in agent/envoy_bootstrap/envoy_bootstrap.go [1106:1152]
func appendStats(b *boot.Bootstrap, nodeId string) error {
tags := make([]*metrics.TagSpecifier, 0)
// Now that we support Service Connect, the nodeId can be of totally different arn format.
// example arn for ECS TaskSet - arn:aws:ecs:us-west-2:123456789012:task-set/MyCluster/MyService/ecs-svc/1234567890123456789
if strings.Contains(nodeId, ":task-set/") {
metric_filter.AppendStatsTagRegexForServiceConnect(&tags)
} else {
res, err := getMeshResourceFromNodeId(nodeId)
if err != nil {
return err
}
enableStatsTags, err := env.Truthy("ENABLE_ENVOY_STATS_TAGS")
if err != nil {
return err
}
if enableStatsTags {
tags = append(tags, &metrics.TagSpecifier{
TagName: "appmesh.mesh",
TagValue: &metrics.TagSpecifier_FixedValue{
FixedValue: res.MeshName,
},
})
tags = append(tags, &metrics.TagSpecifier{
TagName: "appmesh." + res.SnakeCaseType,
TagValue: &metrics.TagSpecifier_FixedValue{
FixedValue: res.Name,
},
})
}
metric_filter.AppendStatsTagRegexForAppMesh(&tags, res)
appendPortProtocolStatPrefixTagRegex(&tags)
}
// If there are no tags, then just bail out
if len(tags) == 0 {
return nil
}
bt := &boot.Bootstrap{
StatsConfig: &metrics.StatsConfig{
StatsTags: tags,
},
}
return mergeBootstrap(b, bt)
}