From daceff6586722fa41305407c19712449e48c8fe1 Mon Sep 17 00:00:00 2001 From: Andrew Wilkins Date: Mon, 8 Jun 2020 14:38:50 +0800 Subject: [PATCH] aggregation/txmetrics: don't group on user-agent (#3848) --- x-pack/apm-server/aggregation/txmetrics/aggregator.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/x-pack/apm-server/aggregation/txmetrics/aggregator.go b/x-pack/apm-server/aggregation/txmetrics/aggregator.go index 162f869b58e..a50109b9bc3 100644 --- a/x-pack/apm-server/aggregation/txmetrics/aggregator.go +++ b/x-pack/apm-server/aggregation/txmetrics/aggregator.go @@ -264,7 +264,7 @@ func makeMetricset(key transactionAggregationKey, ts time.Time, counts []int64, Container: model.Container{ID: key.containerID}, Kubernetes: model.Kubernetes{PodName: key.kubernetesPodName}, }, - User: model.User{UserAgent: key.userAgent}, + // TODO(axw) include browser name, by parsing the user agent // TODO(axw) include client.geo.country_iso_code somewhere }, Transaction: model.MetricsetTransaction{ @@ -304,6 +304,8 @@ type metricsMapEntry struct { type transactionAggregationKey struct { traceRoot bool agentName string + // TODO(axw) requires User-Agent parsing in apm-server. + //browserName string // TODO(axw) requires geoIP lookup in apm-server. //clientCountryISOCode string containerID string @@ -315,7 +317,6 @@ type transactionAggregationKey struct { transactionName string transactionResult string transactionType string - userAgent string } func makeTransactionAggregationKey(tx *model.Transaction) transactionAggregationKey { @@ -339,8 +340,8 @@ func makeTransactionAggregationKey(tx *model.Transaction) transactionAggregation hostname: tx.Metadata.System.Hostname(), containerID: tx.Metadata.System.Container.ID, kubernetesPodName: tx.Metadata.System.Kubernetes.PodName, - userAgent: tx.Metadata.User.UserAgent, + // TODO(axw) browser name, requires parsing User-Agent in apm-server. // TODO(axw) clientCountryISOCode, requires geoIP lookup in apm-server. } } @@ -352,6 +353,7 @@ func (k *transactionAggregationKey) hash() uint64 { h.WriteString("1") } h.WriteString(k.agentName) + // TODO(axw) browserName // TODO(axw) clientCountryISOCode h.WriteString(k.containerID) h.WriteString(k.hostname) @@ -362,7 +364,6 @@ func (k *transactionAggregationKey) hash() uint64 { h.WriteString(k.transactionName) h.WriteString(k.transactionResult) h.WriteString(k.transactionType) - h.WriteString(k.userAgent) return h.Sum64() }