Skip to content

Commit

Permalink
Merge branch 'master' into apmpackage-elasticsearch-privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
axw authored Oct 12, 2021
2 parents 7304533 + b03b3b4 commit e82931b
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 13 deletions.
1 change: 1 addition & 0 deletions changelogs/head.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ https://github.com/elastic/apm-server/compare/7.15\...master[View commits]
- We now record the direct network peer for incoming requests as `source.ip` and `source.port`; origin IP is recorded in `client.ip` {pull}6152[6152]
- We now collect span destination metrics for transactions with too many spans (for example due to transaction_max_spans or exit_span_min_duration) when collected and sent by APM agents {pull}6200[6200]
- `output.elasticsearch.experimental` can be used to enable a new, experimental Elasticsearch output using the go-elasticsearch client {pull}5970[5970]
- Transaction metrics now also group by `service.node.name`, `cloud.provider`, `cloud.region`, `cloud.availability_zone` {pull}6323[6323]

[float]
==== Deprecated
Expand Down
4 changes: 4 additions & 0 deletions docs/metricset-indices.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,14 @@ You can filter and group by these dimensions (some of which are optional, for ex
* `agent.name`: The name of the APM agent that instrumented the transaction, for example `java`
* `service.name`: The name of the service that served the transaction
* `service.version`: The version of the service that served the transaction
* `service.node.name`: The name of the service instance that served the transaction
* `service.environment`: The environment of the service that served the transaction
* `host.hostname`: The hostname of the service that served the transaction
* `container.id`: The container ID of the service that served the transaction
* `kubernetes.pod.name`: The name of the Kubernetes pod running the service that served the transaction
* `cloud.provider`: The cloud provider hosting the service instance that served the transaction
* `cloud.region`: The cloud region hosting the service instance that served the transaction
* `cloud.availability_zone`: The cloud availability zone hosting the service instance that served the transaction
--

The `@timestamp` field of these documents holds the start of the aggregation interval.
Expand Down
45 changes: 32 additions & 13 deletions x-pack/apm-server/aggregation/txmetrics/aggregator.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,10 +351,15 @@ func (a *Aggregator) makeTransactionAggregationKey(event model.APMEvent, interva
serviceEnvironment: event.Service.Environment,
serviceName: event.Service.Name,
serviceVersion: event.Service.Version,
serviceNodeName: event.Service.Node.Name,

hostname: event.Host.Hostname,
containerID: event.Container.ID,
kubernetesPodName: event.Kubernetes.PodName,

cloudProvider: event.Cloud.Provider,
cloudRegion: event.Cloud.Region,
cloudAvailabilityZone: event.Cloud.AvailabilityZone,
}
}

Expand All @@ -378,8 +383,14 @@ func makeMetricset(
Service: model.Service{
Name: key.serviceName,
Version: key.serviceVersion,
Node: model.ServiceNode{Name: key.serviceNodeName},
Environment: key.serviceEnvironment,
},
Cloud: model.Cloud{
Provider: key.cloudProvider,
Region: key.cloudRegion,
AvailabilityZone: key.cloudAvailabilityZone,
},
Host: model.Host{
Hostname: key.hostname,
},
Expand Down Expand Up @@ -426,19 +437,23 @@ type metricsMapEntry struct {

// NOTE(axw) the dimensions should be kept in sync with docs/metricset-indices.asciidoc.
type transactionAggregationKey struct {
timestamp time.Time
traceRoot bool
agentName string
containerID string
hostname string
kubernetesPodName string
serviceEnvironment string
serviceName string
serviceVersion string
transactionName string
transactionResult string
transactionType string
eventOutcome string
timestamp time.Time
traceRoot bool
agentName string
containerID string
hostname string
kubernetesPodName string
cloudProvider string
cloudRegion string
cloudAvailabilityZone string
serviceEnvironment string
serviceName string
serviceVersion string
serviceNodeName string
transactionName string
transactionResult string
transactionType string
eventOutcome string
}

func (k *transactionAggregationKey) hash() uint64 {
Expand All @@ -453,9 +468,13 @@ func (k *transactionAggregationKey) hash() uint64 {
h.WriteString(k.containerID)
h.WriteString(k.hostname)
h.WriteString(k.kubernetesPodName)
h.WriteString(k.cloudProvider)
h.WriteString(k.cloudRegion)
h.WriteString(k.cloudAvailabilityZone)
h.WriteString(k.serviceEnvironment)
h.WriteString(k.serviceName)
h.WriteString(k.serviceVersion)
h.WriteString(k.serviceNodeName)
h.WriteString(k.transactionName)
h.WriteString(k.transactionResult)
h.WriteString(k.transactionType)
Expand Down
4 changes: 4 additions & 0 deletions x-pack/apm-server/aggregation/txmetrics/aggregator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,8 +454,12 @@ func TestAggregationFields(t *testing.T) {
&input.Service.Environment,
&input.Service.Name,
&input.Service.Version,
&input.Service.Node.Name,
&input.Container.ID,
&input.Kubernetes.PodName,
&input.Cloud.Provider,
&input.Cloud.Region,
&input.Cloud.AvailabilityZone,
}

var expected []model.APMEvent
Expand Down

0 comments on commit e82931b

Please sign in to comment.