diff --git a/x-pack/elastic-agent/CHANGELOG.asciidoc b/x-pack/elastic-agent/CHANGELOG.asciidoc index d3fd7758e166..92cf38f69efe 100644 --- a/x-pack/elastic-agent/CHANGELOG.asciidoc +++ b/x-pack/elastic-agent/CHANGELOG.asciidoc @@ -63,3 +63,4 @@ - Use nested objects so fleet can handle metadata correctly {pull}18234[18234] - More clear output of inspect command {pull}18405[18405] - Pick up version from libbeat {pull}18350[18350] +- Use shorter hash for application differentiator {pull}18770[18770] diff --git a/x-pack/elastic-agent/pkg/core/plugin/app/execution_context.go b/x-pack/elastic-agent/pkg/core/plugin/app/execution_context.go index e627f9cfdd10..8d8493359a39 100644 --- a/x-pack/elastic-agent/pkg/core/plugin/app/execution_context.go +++ b/x-pack/elastic-agent/pkg/core/plugin/app/execution_context.go @@ -9,6 +9,10 @@ import ( "fmt" ) +const ( + hashLen = 16 +) + // ExecutionContext describes runnable binary type ExecutionContext struct { BinaryName string @@ -22,6 +26,9 @@ func NewExecutionContext(binaryName, version string, tags map[Tag]string) Execut id := fmt.Sprintf("%s--%s", binaryName, version) if len(tags) > 0 { hash := fmt.Sprintf("%x", sha256.New().Sum([]byte(fmt.Sprint(tags)))) + if len(hash) > hashLen { + hash = hash[:hashLen] + } id += fmt.Sprintf("--%x", hash) }