Skip to content

Commit

Permalink
store navigationTiming marks as scaled floats (#915)
Browse files Browse the repository at this point in the history
* store navigationTiming marks as scaled floats

* test that navigationTiming marks are the only ones impacted
  • Loading branch information
graphaelli authored and simitt committed Jul 4, 2018
1 parent 4f1f917 commit eff9474
Show file tree
Hide file tree
Showing 11 changed files with 58 additions and 2 deletions.
4 changes: 4 additions & 0 deletions docs/data/elasticsearch/transaction.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@
},
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"marks": {
"another_mark": {
"some_float": 10,
"some_long": 10
},
"navigationTiming": {
"appBeforeBootstrap": 608.930000,
"navigationStart": -21
Expand Down
4 changes: 4 additions & 0 deletions docs/data/intake-api/generated/transaction/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@
"navigationStart": -21

},
"another_mark": {
"some_long": 10,
"some_float": 10.0
},
"performance": {}
}
},
Expand Down
7 changes: 7 additions & 0 deletions docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -833,6 +833,13 @@ type: object
A user-defined mapping of groups of marks in milliseconds.
--
*`transaction.marks.navigationTiming`*::
+
--
type: object
--
*`transaction.sampled`*::
Expand Down
2 changes: 1 addition & 1 deletion include/fields.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion processor/transaction/_meta/fields.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,19 @@
description: >
The result of the transaction. HTTP status code for HTTP-related transactions.
- name: marks
- name: marks
type: object
object_type: keyword
dynamic: true
description: >
A user-defined mapping of groups of marks in milliseconds.
- name: marks.navigationTiming
type: object
object_type: scaled_float
scaling_factor: 1000000
dynamic: true

- name: sampled
type: boolean
description: >
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@
},
"id": "945254c5-67a5-417e-8a4e-aa29efcbfb79",
"marks": {
"another_mark": {
"some_float": 10,
"some_long": 10
},
"navigationTiming": {
"appBeforeBootstrap": 608.93,
"navigationStart": -21
Expand Down
3 changes: 3 additions & 0 deletions processor/transaction/package_tests/json_schema_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ func TestPayloadAttributesInSchema(t *testing.T) {
"transactions.context.custom.and_objects.foo",
"transactions.context.tags",
"transactions.context.tags.organization_uuid",
"transactions.marks.another_mark",
"transactions.marks.another_mark.some_long",
"transactions.marks.another_mark.some_float",
"transactions.marks.navigationTiming",
"transactions.marks.navigationTiming.appBeforeBootstrap",
"transactions.marks.navigationTiming.navigationStart",
Expand Down
4 changes: 4 additions & 0 deletions tests/data/valid/transaction/payload.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,10 @@
"navigationStart": -21

},
"another_mark": {
"some_long": 10,
"some_float": 10.0
},
"performance": {}
}
},
Expand Down
3 changes: 3 additions & 0 deletions tests/fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func TestEventAttrsDocumentedInFields(t *testing.T, fieldPaths []string, fn proc
"context.db.instance",
"context.db.user",
"sourcemap",
"transaction.marks.another_mark",
"transaction.marks.another_mark.some_long",
"transaction.marks.another_mark.some_float",
"transaction.marks.performance",
"transaction.marks.navigationTiming",
"transaction.marks.navigationTiming.navigationStart",
Expand Down
17 changes: 17 additions & 0 deletions tests/system/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,23 @@ def test_load_docs_with_template_and_add_transaction(self):

self.check_backend_transaction_sourcemap(count=5)

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_mark_navigation_timing(self):
self.load_docs_with_template(self.get_transaction_payload_path(), self.transactions_url, 'transaction', 9)
self.assert_no_logged_warnings()
mappings = self.es.indices.get_field_mapping(index=self.index_name, fields="transaction.marks.*")
found_other = False
for name, metric in mappings[self.index_name]["mappings"]["doc"].items():
for mapping in metric["mapping"].values():
mtype = mapping["type"]
if name.startswith("transaction.marks.navigationTiming."):
assert mtype == "scaled_float", name + " mapped as " + mtype + ", not scaled_float"
else:
# only navigation timing marks are scaled floats for now
assert mtype != "scaled_float", name + " mapped as scaled_float"
found_other = True
assert found_other, "no non-scaled_float marks found"

@unittest.skipUnless(INTEGRATION_TESTS, "integration test")
def test_load_docs_with_template_and_add_error(self):
"""
Expand Down
4 changes: 4 additions & 0 deletions tests/system/transaction.approved.json
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@
}
},
"marks": {
"another_mark": {
"some_long": 10,
"some_float": 10
},
"navigationTiming": {
"navigationStart": -21,
"appBeforeBootstrap": 608.9300000000001
Expand Down

0 comments on commit eff9474

Please sign in to comment.