Skip to content

Commit

Permalink
Move trace.transaction_id to trace.transaction.id, implements #291 (#345
Browse files Browse the repository at this point in the history
)
  • Loading branch information
jalvz authored and roncohen committed Nov 24, 2017
1 parent 71df0d9 commit d1e0b54
Show file tree
Hide file tree
Showing 11 changed files with 83 additions and 42 deletions.
18 changes: 17 additions & 1 deletion CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,23 @@


=== APM Server version HEAD
https://github.com/elastic/apm-server/compare/f9a2086ceed0b918e1a0b3d8ddc140fc21af0e74\...master[View commits]
https://github.com/elastic/apm-server/compare/71df0d96445df35afe27f38bcf734a0828e0761d\...master[View commits]

==== Breaking changes
- Move `trace.transaction_id` to `trace.transaction.id` {pull}345[345].

==== Bug fixes

==== Added

==== Deprecated

==== Known Issues



=== APM Server version 6.1
https://github.com/elastic/apm-server/compare/f9a2086ceed0b918e1a0b3d8ddc140fc21af0e74\...421db9d1e10935e7b9aec00b64cf66ad2d50d797[View commits]

==== Breaking changes
- Make `transaction.result` a mandatory field {pull}250[250].
Expand Down
4 changes: 3 additions & 1 deletion docs/data/elasticsearch/trace.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@
"start": {
"us": 2830
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "db.postgresql.query"
}
}
3 changes: 2 additions & 1 deletion docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,9 @@ type: long
A locally unique ID of the trace.
[float]
=== `trace.transaction_id`
=== `trace.transaction.id`
type: keyword
Expand Down
12 changes: 8 additions & 4 deletions processor/transaction/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@
description: >
A locally unique ID of the trace.
- name: transaction_id
type: keyword
description: >
Reference to the transaction this trace is part of.
- name: transaction
type: group
fields:

- name: id
type: keyword
description: >
Reference to the transaction this trace is part of.
- name: name
type: keyword
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,9 @@
"start": {
"us": 2830
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "db.postgresql.query"
}
},
Expand Down Expand Up @@ -205,7 +207,9 @@
"start": {
"us": 0
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "request"
}
},
Expand Down Expand Up @@ -234,7 +238,9 @@
"start": {
"us": 1845
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "request"
}
},
Expand Down Expand Up @@ -263,7 +269,9 @@
"start": {
"us": 0
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "request"
}
},
Expand Down Expand Up @@ -443,7 +451,9 @@
"start": {
"us": 2830
},
"transaction_id": "85925e55-b43f-4340-a8e0-df1906ecbfa9",
"transaction": {
"id": "85925e55-b43f-4340-a8e0-df1906ecbfa9"
},
"type": "db.postgresql.query"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@
"start": {
"us": 0
},
"transaction_id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"transaction": {
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79"
},
"type": "request"
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,9 @@
"start": {
"us": 0
},
"transaction_id": "85925e55-b43f-4340-a8e0-df1906ecbf7a",
"transaction": {
"id": "85925e55-b43f-4340-a8e0-df1906ecbf7a"
},
"type": "request"
}
},
Expand Down Expand Up @@ -238,7 +240,9 @@
"start": {
"us": 2830
},
"transaction_id": "85925e55-b43f-4340-a8e0-df1906ecbf7a",
"transaction": {
"id": "85925e55-b43f-4340-a8e0-df1906ecbf7a"
},
"type": "db.postgresql.query"
}
},
Expand Down Expand Up @@ -271,7 +275,9 @@
"start": {
"us": 0
},
"transaction_id": "85925e55-b43f-4340-a8e0-df1906ecbf7a",
"transaction": {
"id": "85925e55-b43f-4340-a8e0-df1906ecbf7a"
},
"type": "request"
}
}
Expand Down
2 changes: 1 addition & 1 deletion processor/transaction/package_tests/json_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ func TestJsonSchemaKeywordLimitation(t *testing.T) {
"./../../../_meta/fields.common.yml",
"./../_meta/fields.yml",
}
exceptions := set.New("processor.event", "processor.name", "context.app.name", "transaction.id", "trace.transaction_id", "listening")
exceptions := set.New("processor.event", "processor.name", "context.app.name", "transaction.id", "trace.transaction.id", "listening")
tests.TestJsonSchemaKeywordLimitation(t, fieldsPaths, transaction.Schema(), exceptions)
}
10 changes: 5 additions & 5 deletions processor/transaction/payload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@ func TestPayloadTransform(t *testing.T) {
"name": "transaction",
},
"trace": common.MapStr{
"duration": common.MapStr{"us": 0},
"name": "",
"start": common.MapStr{"us": 0},
"transaction_id": "",
"type": "",
"duration": common.MapStr{"us": 0},
"name": "",
"start": common.MapStr{"us": 0},
"transaction": common.MapStr{"id": ""},
"type": "",
},
}

Expand Down
2 changes: 1 addition & 1 deletion processor/transaction/trace.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func (t *Trace) Transform(transactionId string) common.MapStr {
enhancer := utility.NewMapStrEnhancer()
tr := common.MapStr{}
enhancer.Add(tr, "id", t.Id)
enhancer.Add(tr, "transaction_id", transactionId)
enhancer.Add(tr, "transaction", common.MapStr{"id": transactionId})
enhancer.Add(tr, "name", t.Name)
enhancer.Add(tr, "type", t.Type)
enhancer.Add(tr, "start", utility.MillisAsMicros(t.Start))
Expand Down
38 changes: 19 additions & 19 deletions processor/transaction/trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ func TestTraceTransform(t *testing.T) {
}
transactionId := "123"
emptyOut := common.MapStr{
"duration": common.MapStr{"us": 0},
"name": "",
"start": common.MapStr{"us": 0},
"transaction_id": "123",
"type": "",
"duration": common.MapStr{"us": 0},
"name": "",
"start": common.MapStr{"us": 0},
"transaction": common.MapStr{"id": "123"},
"type": "",
}

path := "test/path"
Expand All @@ -42,12 +42,12 @@ func TestTraceTransform(t *testing.T) {
{
Trace: Trace{StacktraceFrames: frames},
Output: common.MapStr{
"type": "",
"start": common.MapStr{"us": 0},
"duration": common.MapStr{"us": 0},
"stacktrace": []common.MapStr{{"filename": "", "line": common.MapStr{"number": 0}}},
"transaction_id": "123",
"name": "",
"type": "",
"start": common.MapStr{"us": 0},
"duration": common.MapStr{"us": 0},
"stacktrace": []common.MapStr{{"filename": "", "line": common.MapStr{"number": 0}}},
"transaction": common.MapStr{"id": "123"},
"name": "",
},
Msg: "Trace with empty Stacktrace, default Stacktrace Transform",
},
Expand Down Expand Up @@ -78,14 +78,14 @@ func TestTraceTransform(t *testing.T) {
TransformStacktrace: transformFn,
},
Output: common.MapStr{
"duration": common.MapStr{"us": 1200},
"id": 1,
"name": "mytrace",
"start": common.MapStr{"us": 650},
"transaction_id": "123",
"type": "mytracetype",
"stacktrace": []common.MapStr{{"foo": "bar"}},
"parent": 12,
"duration": common.MapStr{"us": 1200},
"id": 1,
"name": "mytrace",
"start": common.MapStr{"us": 650},
"transaction": common.MapStr{"id": "123"},
"type": "mytracetype",
"stacktrace": []common.MapStr{{"foo": "bar"}},
"parent": 12,
},
Msg: "Full Trace, transformFn for Stacktrace Transform",
},
Expand Down

0 comments on commit d1e0b54

Please sign in to comment.