From 7e8d78324ea93d9e5883bc401316ecbf7b8f1864 Mon Sep 17 00:00:00 2001 From: Silvia Mitter Date: Thu, 28 Jun 2018 12:27:42 +0200 Subject: [PATCH] Add context.http.url to spans. (#1037) * Add context.http.url to spans. implements #777 --- docs/data/elasticsearch/span.json | 3 +++ .../data/intake-api/generated/transaction/payload.json | 3 +++ docs/spec/transactions/span.json | 10 ++++++++++ processor/transaction/generated/schema/payload.go | 10 ++++++++++ .../TestProcessTransactionFrontend.approved.json | 3 +++ .../TestProcessTransactionFull.approved.json | 3 +++ testdata/transaction/frontend.json | 7 ++++++- testdata/transaction/payload.json | 3 +++ tests/fields.go | 1 + tests/system/spans.approved.json | 3 +++ 10 files changed, 45 insertions(+), 1 deletion(-) diff --git a/docs/data/elasticsearch/span.json b/docs/data/elasticsearch/span.json index 1c687b6ce2c..79c280b1081 100644 --- a/docs/data/elasticsearch/span.json +++ b/docs/data/elasticsearch/span.json @@ -6,6 +6,9 @@ "type": "sql", "user": "readonly_user" }, + "http": { + "url": "http://localhost:8000" + }, "service": { "agent": { "name": "elastic-node", diff --git a/docs/data/intake-api/generated/transaction/payload.json b/docs/data/intake-api/generated/transaction/payload.json index 1a293435e74..7073772c7ba 100644 --- a/docs/data/intake-api/generated/transaction/payload.json +++ b/docs/data/intake-api/generated/transaction/payload.json @@ -163,6 +163,9 @@ "statement": "SELECT * FROM product_types WHERE user_id=?", "type": "sql", "user": "readonly_user" + }, + "http": { + "url": "http://localhost:8000" } } }, diff --git a/docs/spec/transactions/span.json b/docs/spec/transactions/span.json index b8dc2a67664..837874e0b35 100644 --- a/docs/spec/transactions/span.json +++ b/docs/spec/transactions/span.json @@ -31,6 +31,16 @@ "description": "Username for accessing database" } } + }, + "http": { + "type": ["object", "null"], + "description": "An object containing contextual data of the related http request.", + "properties": { + "url": { + "type": ["string", "null"], + "description": "The raw url of the correlating http request." + } + } } } }, diff --git a/processor/transaction/generated/schema/payload.go b/processor/transaction/generated/schema/payload.go index f8d2ac1d02a..6e76bad7a79 100644 --- a/processor/transaction/generated/schema/payload.go +++ b/processor/transaction/generated/schema/payload.go @@ -409,6 +409,16 @@ const PayloadSchema = `{ "description": "Username for accessing database" } } + }, + "http": { + "type": ["object", "null"], + "description": "An object containing contextual data of the related http request.", + "properties": { + "url": { + "type": ["string", "null"], + "description": "The raw url of the correlating http request." + } + } } } }, diff --git a/processor/transaction/package_tests/TestProcessTransactionFrontend.approved.json b/processor/transaction/package_tests/TestProcessTransactionFrontend.approved.json index 7463884ce1d..98fde52f0be 100644 --- a/processor/transaction/package_tests/TestProcessTransactionFrontend.approved.json +++ b/processor/transaction/package_tests/TestProcessTransactionFrontend.approved.json @@ -52,6 +52,9 @@ { "@timestamp": "-", "context": { + "http": { + "url": "http://localhost:8000/test/e2e/general-usecase/span" + }, "service": { "agent": { "name": "apm-js", diff --git a/processor/transaction/package_tests/TestProcessTransactionFull.approved.json b/processor/transaction/package_tests/TestProcessTransactionFull.approved.json index ca15cb01734..b76893b6b8e 100644 --- a/processor/transaction/package_tests/TestProcessTransactionFull.approved.json +++ b/processor/transaction/package_tests/TestProcessTransactionFull.approved.json @@ -148,6 +148,9 @@ "type": "sql", "user": "readonly_user" }, + "http": { + "url": "http://localhost:8000" + }, "service": { "agent": { "name": "elastic-node", diff --git a/testdata/transaction/frontend.json b/testdata/transaction/frontend.json index 73d2013164c..09e1c91d9fc 100644 --- a/testdata/transaction/frontend.json +++ b/testdata/transaction/frontend.json @@ -33,7 +33,12 @@ "lineno": 1, "colno": 18 } - ] + ], + "context": { + "http": { + "url": "http://localhost:8000/test/e2e/general-usecase/span" + } + } } ], "context": { diff --git a/testdata/transaction/payload.json b/testdata/transaction/payload.json index 1a293435e74..7073772c7ba 100644 --- a/testdata/transaction/payload.json +++ b/testdata/transaction/payload.json @@ -163,6 +163,9 @@ "statement": "SELECT * FROM product_types WHERE user_id=?", "type": "sql", "user": "readonly_user" + }, + "http": { + "url": "http://localhost:8000" } } }, diff --git a/tests/fields.go b/tests/fields.go index 13fbafeedc5..3faaea3d4c7 100644 --- a/tests/fields.go +++ b/tests/fields.go @@ -59,6 +59,7 @@ func TestEventAttrsDocumentedInFields(t *testing.T, fieldPaths []string, fn proc "context.db.type", "context.db.instance", "context.db.user", + "context.http", "sourcemap", "transaction.marks.another_mark", "transaction.marks.another_mark.some_long", diff --git a/tests/system/spans.approved.json b/tests/system/spans.approved.json index 9f968922a59..1e5867145d7 100644 --- a/tests/system/spans.approved.json +++ b/tests/system/spans.approved.json @@ -198,6 +198,9 @@ "user": "readonly_user", "statement": "SELECT * FROM product_types WHERE user_id=?" }, + "http": { + "url": "http://localhost:8000" + }, "service": { "name": "1234_service-12a3", "agent": {