Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add faas.{name,verson} to tx + txmetrics #7427

Merged
merged 5 commits into from
Mar 2, 2022

Conversation

stuartnelson3
Copy link
Contributor

Motivation/summary

We want to capture faas.name and faas.version for lambda functions

Checklist

How to test these changes

  1. Send FaaS transactions to apm-server
  2. Check that faas.name and faas.version show up in the transaction documents and transaction metrics

Related issues

closes #7410

@stuartnelson3 stuartnelson3 added v8.2.0 backport-8.2 Automated backport with mergify labels Mar 1, 2022
@stuartnelson3 stuartnelson3 requested a review from a team March 1, 2022 07:55
@apmmachine
Copy link
Collaborator

apmmachine commented Mar 1, 2022

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2022-03-02T10:04:33.993+0000

  • Duration: 49 min 3 sec

Test stats 🧪

Test Results
Failed 0
Passed 5652
Skipped 19
Total 5671

🤖 GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

  • /hey-apm : Run the hey-apm benchmark.

  • /package : Generate and publish the docker images.

  • run elasticsearch-ci/docs : Re-trigger the docs validation. (use unformatted text in the comment!)

Copy link
Contributor

@marclop marclop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@marclop marclop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, can we also add the fields to the transaction that has FaaS fields in testdata/intake-v2/transactions.ndjson?

@marclop
Copy link
Contributor

marclop commented Mar 2, 2022

Last, #7299 will add a new document to the APM Server guide with all the transaction aggregation dimensions documented. We should either update the docs as a follow-up, in this PR or that PR, whichever we prefer.

@stuartnelson3 stuartnelson3 enabled auto-merge (squash) March 2, 2022 10:04
@stuartnelson3 stuartnelson3 merged commit 4ff43c9 into elastic:main Mar 2, 2022
@stuartnelson3 stuartnelson3 deleted the faas-name-version branch March 2, 2022 12:20
v1v added a commit to v1v/apm-server that referenced this pull request Mar 7, 2022
* upstream/main:
  Update to elastic/beats@111b1db6792c (elastic#7470)
  [Automation] Update elastic stack version to 8.2.0-a12f7069 for testing (elastic#7472)
  [Automation] Update elastic stack version to 8.2.0-190af159 for testing (elastic#7458)
  Add X-Elastic-Product-Origin header to es requests (elastic#7442)
  modelindexer: Report all Stack Monitoring metrics (elastic#7428)
  Update to elastic/beats@0099f5cf517e (elastic#7454)
  Update to elastic/beats@02d45e2ee434 (elastic#7447)
  add faas.{name,verson} to tx + txmetrics (elastic#7427)
  [Automation] Update elastic stack version to 8.2.0-43df679f for testing (elastic#7439)
  Update to elastic/beats@0133c2289503 (elastic#7434)
  Remove coming tag (elastic#7391)
  Update to elastic/beats@ff8e2346f70b (elastic#7423)
  [Automation] Update elastic stack version to 8.2.0-bdf2ad74 for testing (elastic#7424)
  Update APM Add to Project Parameter Types (elastic#7418)
@marclop marclop self-assigned this Apr 4, 2022
@marclop
Copy link
Contributor

marclop commented Apr 4, 2022

Verified with BC1:

Applied the following git patch

diff --git a/testdata/intake-v2/transactions.ndjson b/testdata/intake-v2/transactions.ndjson
index b0b84b674..0fa71ed29 100644
--- a/testdata/intake-v2/transactions.ndjson
+++ b/testdata/intake-v2/transactions.ndjson
@@ -3,4 +3,4 @@
 {"transaction": {"id": "4340a8e0df1906ecbfa9", "trace_id": "0acd456789abcdef0123456789abcdef", "name": "GET /api/types","type": "request","duration": 32.592981,"outcome":"success", "result": "success", "timestamp": 1496170407154000, "sampled": true, "span_count": {"started": 17},"context": {"service": {"runtime": {"version": "7.0"}},"page":{"referer":"http://localhost:8000/test/e2e/","url":"http://localhost:8000/test/e2e/general-usecase/"}, "request": {"socket": {"remote_address": "12.53.12.1","encrypted": true},"http_version": "1.1","method": "POST","url": {"protocol": "https:","full": "https://www.example.com/p/a/t/h?query=string#hash","hostname": "www.example.com","port": "8080","pathname": "/p/a/t/h","search": "?query=string","hash": "#hash","raw": "/p/a/t/h?query=string#hash"},"headers": {"user-agent":["Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.103 Safari/537.36","Mozilla Chrome Edge"],"content-type": "text/html","cookie": "c1=v1, c2=v2","some-other-header": "foo","array": ["foo","bar","baz"]},"cookies": {"c1": "v1","c2": "v2"},"env": {"SERVER_SOFTWARE": "nginx","GATEWAY_INTERFACE": "CGI/1.1"},"body": {"str": "hello world","additional": { "foo": {},"bar": 123,"req": "additional information"}}},"response": {"status_code": 200,"headers": {"content-type": "application/json"},"headers_sent": true,"finished": true,"transfer_size":25.8,"encoded_body_size":26.90,"decoded_body_size":29.90}, "user": {"domain": "ldap://abc","id": "99","username": "foo"},"tags": {"organization_uuid": "9f0e9d64-c185-4d21-a6f4-4673ed561ec8", "tag2": 12, "tag3": 12.45, "tag4": false, "tag5": null },"custom": {"my_key": 1,"some_other_value": "foo bar","and_objects": {"foo": ["bar","baz"]},"(": "not a valid regex and that is fine"}}}}
 {"transaction": { "id": "cdef4340a8e0df19", "trace_id": "0acd456789abcdef0123456789abcdef", "type": "request", "duration": 13.980558, "timestamp": 1532976822281000, "sampled": null, "span_count": { "dropped": 55, "started": 436 }, "marks": {"navigationTiming": {"appBeforeBootstrap": 608.9300000000001,"navigationStart": -21},"another_mark": {"some_long": 10,"some_float": 10.0}, "performance": {}}, "context": { "request": { "socket": { "remote_address": "192.0.1", "encrypted": null }, "method": "POST", "headers": { "user-agent": null, "content-type": null, "cookie": null }, "url": { "protocol": null, "full": null, "hostname": null, "port": null, "pathname": null, "search": null, "hash": null, "raw": null } }, "response": { "headers": { "content-type": null } }, "service": {"environment":"testing","name": "service1","node": {"configured_name": "node-ABC"}, "language": {"version": "2.5", "name": "ruby"}, "agent": {"version": "2.2", "name": "elastic-ruby", "ephemeral_id": "justanid"}, "framework": {"version": "5.0", "name": "Rails"}, "version": "2", "runtime": {"version": "2.5", "name": "cruby"}}},"experience":{"cls":1,"fid":2.0,"tbt":3.4,"longtask":{"count":3,"sum":2.5,"max":1}}}}
 {"transaction": { "id": "00xxxxFFaaaa1234", "trace_id": "0123456789abcdef0123456789abcdef", "name": "amqp receive", "parent_id": "abcdefabcdef01234567", "type": "messaging", "duration": 3, "span_count": { "started": 1 }, "context": {"message": {"queue": { "name": "new_users"}, "age":{ "ms": 1577958057123}, "headers": {"user_id": "1ax3", "involved_services": ["user", "auth"]}, "body": "user created", "routing_key": "user-created-transaction"}},"session":{"id":"sunday","sequence":123}}}
-{"transaction": { "name": "july-2021-delete-after-july-31", "type": "lambda", "result": "success", "id": "142e61450efb8574", "trace_id": "eb56529a1f461c5e7e2f66ecb075e983", "subtype": null, "action": null, "duration": 38.853, "timestamp": 1631736666365048, "sampled": true, "context": { "cloud": { "origin": { "account": { "id": "abc123" }, "provider": "aws", "region": "us-east-1", "service": { "name": "serviceName" } } }, "service": { "origin": { "id": "abc123", "name": "service-name", "version": "1.0" } }, "user": {}, "tags": {}, "custom": { } }, "sync": true, "span_count": { "started": 0 }, "outcome": "unknown", "faas": { "name": "faasName", "version": "1.0.0", "coldstart": false, "execution": "2e13b309-23e1-417f-8bf7-074fc96bc683", "trigger": { "request_id": "FuH2Cir_vHcEMUA=", "type": "http" } }, "sample_rate": 1 } }
+{"transaction": { "name": "july-2021-delete-after-july-31", "type": "lambda", "result": "success", "id": "142e61450efb8574", "trace_id": "eb56529a1f461c5e7e2f66ecb075e983", "subtype": null, "action": null, "duration": 38.853, "timestamp": 1631736666365048, "sampled": true, "context": { "cloud": { "origin": { "account": { "id": "abc123" }, "provider": "aws", "region": "us-east-1", "service": { "name": "serviceName" } } }, "service": { "origin": { "id": "abc123", "name": "service-name", "version": "1.0" } }, "user": {}, "tags": {}, "custom": { } }, "sync": true, "span_count": { "started": 0 }, "outcome": "unknown", "faas": {"id": "aws", "name": "name", "version": "1.0.0", "coldstart": false, "execution": "2e13b309-23e1-417f-8bf7-074fc96bc683", "trigger": { "request_id": "FuH2Cir_vHcEMUA=", "type": "http" } }, "sample_rate": 1 } }
$ curl -H "Content-type: application/x-ndjson" --data-binary @testdata/intake-v2/transactions.ndjson http://localhost:8200/intake/v2/events

Verified that faas.name and faas.version appears up in the metrics document.

image

mergify bot pushed a commit that referenced this pull request Apr 4, 2022
(cherry picked from commit 4ff43c9)

# Conflicts:
#	apmpackage/apm/changelog.yml
#	changelogs/head.asciidoc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add faas.name and faas.version to intake and transaction metrics
3 participants