Skip to content

Commit 4ff43c9

Browse files
add faas.{name,verson} to tx + txmetrics (#7427)
1 parent 34216ef commit 4ff43c9

File tree

18 files changed

+80
-4
lines changed

18 files changed

+80
-4
lines changed

apmpackage/apm/changelog.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
- description: added `span.links` fields to traces and rum_traces data streams
1010
type: enhancement
1111
link: https://github.com/elastic/apm-server/pull/7291
12+
- description: Added field mapping for `faas.name` and `faas.version` to internal_metrics data stream
13+
type: enhancement
14+
link: https://github.com/elastic/apm-server/pull/7427
1215
- version: "8.1.0"
1316
changes:
1417
- description: Added field mapping for `faas.coldstart` and `faas.trigger.type`

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@
1515
type: keyword
1616
description: |
1717
The trigger type.
18+
- name: name
19+
type: keyword
20+
description: |
21+
The lambda function name.
22+
- name: version
23+
type: keyword
24+
description: |
25+
The lambda function version.
1826
- name: kubernetes
1927
title: Kubernetes
2028
type: group

apmpackage/apm/data_stream/traces/fields/fields.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,14 @@
5555
type: keyword
5656
description: |
5757
The trigger type.
58+
- name: name
59+
type: keyword
60+
description: |
61+
The lambda function name.
62+
- name: version
63+
type: keyword
64+
description: |
65+
The lambda function version.
5866
- name: http
5967
type: group
6068
fields:

beater/test_approved_es_documents/TestPublishIntegrationTransactions.approved.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,8 +725,10 @@
725725
"faas": {
726726
"coldstart": false,
727727
"execution": "2e13b309-23e1-417f-8bf7-074fc96bc683",
728+
"name": "faasName",
728729
"trigger.request_id": "FuH2Cir_vHcEMUA=",
729-
"trigger.type": "http"
730+
"trigger.type": "http",
731+
"version": "1.0.0"
730732
},
731733
"host": {
732734
"architecture": "x64",

changelogs/head.asciidoc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ See <<apm-server-configuration>> for more information.
2121

2222
[float]
2323
==== Intake API Changes
24+
- Support for `faas.name` and `faas.version` added to intake and transaction metrics {pull}7427[7427]
2425

2526
[float]
2627
==== Added

docs/spec/v2/transaction.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,13 @@
833833
"string"
834834
]
835835
},
836+
"name": {
837+
"description": "The lambda function name.",
838+
"type": [
839+
"null",
840+
"string"
841+
]
842+
},
836843
"trigger": {
837844
"description": "Trigger attributes.",
838845
"type": [
@@ -855,6 +862,13 @@
855862
]
856863
}
857864
}
865+
},
866+
"version": {
867+
"description": "The lambda function version.",
868+
"type": [
869+
"null",
870+
"string"
871+
]
858872
}
859873
}
860874
},

model/apmevent_test.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ func TestAPMEventFields(t *testing.T) {
109109
Execution: "execution",
110110
TriggerType: "http",
111111
TriggerRequestID: "abc123",
112+
Name: "faasName",
113+
Version: "1.0.0",
112114
},
113115
Cloud: Cloud{
114116
Origin: &CloudOrigin{
@@ -184,6 +186,8 @@ func TestAPMEventFields(t *testing.T) {
184186
"execution": "execution",
185187
"trigger.type": "http",
186188
"trigger.request_id": "abc123",
189+
"name": "faasName",
190+
"version": "1.0.0",
187191
},
188192
"cloud": common.MapStr{
189193
"origin": common.MapStr{

model/faas.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@ type FAAS struct {
2626
Execution string
2727
TriggerType string
2828
TriggerRequestID string
29+
Name string
30+
Version string
2931
}
3032

3133
func (f *FAAS) fields() common.MapStr {
@@ -35,5 +37,7 @@ func (f *FAAS) fields() common.MapStr {
3537
fields.maybeSetString("execution", f.Execution)
3638
fields.maybeSetString("trigger.type", f.TriggerType)
3739
fields.maybeSetString("trigger.request_id", f.TriggerRequestID)
40+
fields.maybeSetString("name", f.Name)
41+
fields.maybeSetString("version", f.Version)
3842
return common.MapStr(fields)
3943
}

model/modeldecoder/rumv3/metadata_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,8 @@ func metadataExceptions(keys ...string) func(key string) bool {
6565
"FAAS.Execution",
6666
"FAAS.TriggerType",
6767
"FAAS.TriggerRequestID",
68+
"FAAS.Name",
69+
"FAAS.Version",
6870
"Experimental",
6971
"HTTP",
7072
"Kubernetes",

model/modeldecoder/v2/decoder.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,12 @@ func mapToFAASModel(from faas, faas *model.FAAS) {
243243
if from.Trigger.RequestID.IsSet() {
244244
faas.TriggerRequestID = from.Trigger.RequestID.Val
245245
}
246+
if from.Name.IsSet() {
247+
faas.Name = from.Name.Val
248+
}
249+
if from.Version.IsSet() {
250+
faas.Version = from.Version.Val
251+
}
246252
}
247253
}
248254

0 commit comments

Comments
 (0)