Skip to content

Commit 5f72138

Browse files
authored
Introduce metricset.name (#4857)
* Add metricset.name field to metrics docs * aggregation/txmetrics: set metricset.name * aggregation/spanmetrics: set metricset.name * Add changelog entry
1 parent 742d429 commit 5f72138

19 files changed

Lines changed: 82 additions & 6 deletions

File tree

NOTICE.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Elastic APM Server
22
Copyright 2014-2021 Elasticsearch BV
33

4-
This product includes software developed by The Apache Software
4+
This product includes software developed by The Apache Software
55
Foundation (http://www.apache.org/).
66

77
================================================================================
@@ -19976,13 +19976,13 @@ Contents of probable licence file $GOMODCACHE/howett.net/plist@v0.0.0-2020120308
1997619976
Copyright (c) 2013, Dustin L. Howett. All rights reserved.
1997719977

1997819978
Redistribution and use in source and binary forms, with or without
19979-
modification, are permitted provided that the following conditions are met:
19979+
modification, are permitted provided that the following conditions are met:
1998019980

1998119981
1. Redistributions of source code must retain the above copyright notice, this
19982-
list of conditions and the following disclaimer.
19982+
list of conditions and the following disclaimer.
1998319983
2. Redistributions in binary form must reproduce the above copyright notice,
1998419984
this list of conditions and the following disclaimer in the documentation
19985-
and/or other materials provided with the distribution.
19985+
and/or other materials provided with the distribution.
1998619986

1998719987
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1998819988
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
@@ -19996,7 +19996,7 @@ ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1999619996
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1999719997

1999819998
The views and conclusions contained in the software and documentation are those
19999-
of the authors and should not be interpreted as representing official policies,
19999+
of the authors and should not be interpreted as representing official policies,
2000020000
either expressed or implied, of the FreeBSD Project.
2000120001

2000220002
--------------------------------------------------------------------------------

apmpackage/apm/0.1.0/data_stream/app_metrics/fields/fields.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
type: keyword
2525
description: |
2626
Kubernetes Pod UID
27+
- name: metricset.name
28+
type: keyword
29+
description: |
30+
Name of the set of metrics.
2731
- name: metricset.period
2832
type: long
2933
description: Current data collection period for this event in milliseconds.

apmpackage/apm/0.1.0/data_stream/internal_metrics/fields/fields.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@
2424
type: keyword
2525
description: |
2626
Kubernetes Pod UID
27+
- name: metricset.name
28+
type: keyword
29+
description: |
30+
Name of the set of metrics.
2731
- name: metricset.period
2832
type: long
2933
description: Current data collection period for this event in milliseconds.

apmpackage/apm/0.1.0/docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -451,6 +451,7 @@ Metrics are written to `metrics-apm.*`, `metrics-apm.internal.*` and `metrics-ap
451451
|kubernetes.pod.name|Kubernetes pod name|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
452452
|kubernetes.pod.uid|Kubernetes Pod UID|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
453453
|labels|A flat mapping of user-defined labels with string, boolean or number values.|object| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
454+
|metricset.name|Name of the set of metrics.|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
454455
|metricset.period|Current data collection period for this event in milliseconds.|long| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |
455456
|observer.hostname|Hostname of the APM Server.|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-yes.png) |
456457
|observer.listening|Address the server is listening on.|keyword| ![](https://doc-icons.s3.us-east-2.amazonaws.com/icon-no.png) |

changelogs/head.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ https://github.com/elastic/apm-server/compare/7.11\...master[View commits]
3131
* Support additional config options when running under Fleet {pull}4690[4690]
3232
* Upgrade Go to 1.15.8 {pull}4733[4733]
3333
* Add support for Node.js wall time profiles {pull}4728[4728]
34+
* Add metricset.name field to metric docs {pull}4857[4857]
3435

3536
[float]
3637
==== Deprecated

docs/fields.asciidoc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4857,6 +4857,19 @@ type: object
48574857
48584858
--
48594859
4860+
4861+
*`metricset.name`*::
4862+
+
4863+
--
4864+
Name of the set of metrics.
4865+
4866+
4867+
type: keyword
4868+
4869+
example: transaction
4870+
4871+
--
4872+
48604873
[float]
48614874
=== service
48624875

include/fields.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

model/metricset.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ type Metricset struct {
8585
// instance, such as a hash of the labels used for aggregating the
8686
// metrics.
8787
TimeseriesInstanceID string
88+
89+
// Name holds an optional name for the metricset.
90+
Name string
8891
}
8992

9093
// Sample represents a single named metric.
@@ -197,6 +200,10 @@ func (me *Metricset) Transform(ctx context.Context, cfg *transform.Config) []bea
197200
fields["timeseries"] = common.MapStr{"instance": me.TimeseriesInstanceID}
198201
}
199202

203+
if me.Name != "" {
204+
fields["metricset.name"] = me.Name
205+
}
206+
200207
fields["processor"] = metricsetProcessorEntry
201208

202209
if cfg.DataStreams {

model/metricset/_meta/fields.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
description: >
3838
A flat mapping of user-defined labels with string, boolean or number values.
3939
40+
- name: metricset
41+
type: group
42+
fields:
43+
- name: name
44+
type: keyword
45+
description: >
46+
Name of the set of metrics.
47+
example: transaction
48+
4049
- name: service
4150
type: group
4251
dynamic: false

model/metricset_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,21 @@ func TestTransform(t *testing.T) {
7272
},
7373
Msg: "Payload with empty metric.",
7474
},
75+
{
76+
Metricset: &Metricset{Timestamp: timestamp, Metadata: metadata, Name: "raj"},
77+
Output: []common.MapStr{
78+
{
79+
"data_stream.type": "metrics",
80+
"data_stream.dataset": "apm.app.myservice",
81+
"processor": common.MapStr{"event": "metric", "name": "metric"},
82+
"metricset.name": "raj",
83+
"service": common.MapStr{
84+
"name": "myservice",
85+
},
86+
},
87+
},
88+
Msg: "Payload with metricset name.",
89+
},
7590
{
7691
Metricset: &Metricset{
7792
Metadata: metadata,

0 commit comments

Comments
 (0)