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

[Error] Unprocessed trace - Invalid Subsegment Name #29

Closed
adrianpaiva1 opened this issue Jan 18, 2023 · 3 comments
Closed

[Error] Unprocessed trace - Invalid Subsegment Name #29

adrianpaiva1 opened this issue Jan 18, 2023 · 3 comments

Comments

@adrianpaiva1
Copy link
Contributor

adrianpaiva1 commented Jan 18, 2023

So I'm using the daemon and most of my requests are not being logged, only some of my GET requests are working.

Looking through the Daemon logs, there are a bunch of these errors.

It looks to me like it's failing because there are invalid characters being set for the sub segment names, in my case my best guess is the '?' in "name": "mysql at RouteBinding:?", below. If I disable the Database query traces it appears to be working.

Is it possible to remove non supported characters from the segment names to match the supported ones?

https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html#api-segmentdocuments-fields

2023-01-18T18:05:40Z [Error] Unprocessed trace 1-63c834f4-107c98a429f50b1a561f013a, segment: { xray_1 | ErrorCode: "InvalidName", xray_1 | Id: "ca2a3dfacbb4db1d", xray_1 | Message: "Invalid subsegment. ErrorCode: InvalidName, Cause: null" xray_1 | }

This is an example of the trace it's trying to submit

{ "id": "ca2a3dfacbb4db1d", "trace_id": "1-63c834f4-107c98a429f50b1a561f013a", "name": "APP HTTP", "start_time": 1674065140.307433, "end_time": 1674065140.44286, "subsegments": [ { "id": "2273081f032ba796", "name": "laravel boot", "start_time": 1674065140.294943, "end_time": 1674065140.316362 }, { "id": "ad292b6331b4980c", "name": "mysql at AuthDomain:33", "start_time": 1674065140.413419, "end_time": 1674065140.5058491, "metadata": { "backtrace": [ "App\\AuthDomain:33", "App\\AuthDomain:44", "App\\AuthDomain:132", "Illuminate\\Auth\\SessionGuard:124", "Illuminate\\Auth\\SessionGuard:336", "Illuminate\\Auth\\AuthManager:25", "App\\Scopes\\DomainScope:1170", "Illuminate\\Auth\\EloquentUserProvider:42", "Laravel\\Passport\\PassportUserProvider:229", "Laravel\\Passport\\Guards\\TokenGuard:112" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select * from domainswheresub_domain= 'dev' anddomains.deleted_atis null limit 1" } }, { "id": "329d707c49dba220", "name": "mysql at EloquentUserProvider:42", "start_time": 1674065140.416229, "end_time": 1674065140.417839, "metadata": { "backtrace": [ "Illuminate\\Auth\\EloquentUserProvider:42", "Laravel\\Passport\\PassportUserProvider:229", "Laravel\\Passport\\Guards\\TokenGuard:112", "Laravel\\Passport\\Guards\\TokenGuard:309", "Laravel\\Passport\\PassportServiceProvider:?", "Illuminate\\Auth\\RequestGuard:60", "Illuminate\\Auth\\RequestGuard:63", "Illuminate\\Auth\\Middleware\\Authenticate:42", "Illuminate\\Auth\\Middleware\\Authenticate:167", "Illuminate\\Pipeline\\Pipeline:103" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select * fromuserswhereid= 'c642ff79-1d03-40d1-9094-7885fa7033da' andusers.deleted_atis null andusers.domain_id= '19d49344-1173-4ae1-b2fd-500632db0ec6' limit 1" } }, { "id": "72d3fc0e1ac03e30", "name": "mysql at RouteBinding:?", "start_time": 1674065140.42018, "end_time": 1674065140.42206, "metadata": { "backtrace": [ "Illuminate\\Routing\\RouteBinding:?", "Illuminate\\Routing\\Router:842", "Illuminate\\Routing\\Router:39", "Illuminate\\Routing\\Middleware\\SubstituteBindings:167", "Illuminate\\Pipeline\\Pipeline:65", "Illuminate\\Routing\\Middleware\\ThrottleRequestsWithRedis:63", "Illuminate\\Routing\\Middleware\\ThrottleRequests:167", "Illuminate\\Pipeline\\Pipeline:44", "Illuminate\\Auth\\Middleware\\Authenticate:167", "Illuminate\\Pipeline\\Pipeline:103" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select * fromdomainswheresub_domain= 'dev' anddomains.deleted_atis null limit 1" } }, { "id": "41ee2cb8b5eb623e", "name": "mysql at CmsFolder:34", "start_time": 1674065140.429208, "end_time": 1674065140.433018, "metadata": { "backtrace": [ "App\\Models\\CmsFolder:34", "App\\Models\\CmsFolder:1475", "App\\Models\\CmsFolder:20", "App\\Models\\CmsFolder:1475", "App\\Services\\CmsFolderService:45", "App\\Http\\Controllers\\Api\\CmsFolderController:54", "Illuminate\\Routing\\Controller:45", "Illuminate\\Routing\\ControllerDispatcher:262", "Illuminate\\Routing\\Route:205", "Illuminate\\Routing\\Route:721" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select * fromcms_folderswhereparent_idis null andcms_folders.domain_id= '19d49344-1173-4ae1-b2fd-500632db0ec6' andcms_folders.deleted_atis null limit 1" } }, { "id": "bd2f1abe49e2e804", "name": "mysql at CmsFolderService:45", "start_time": 1674065140.433237, "end_time": 1674065140.436227, "metadata": { "backtrace": [ "App\\Services\\CmsFolderService:45", "App\\Http\\Controllers\\Api\\CmsFolderController:54", "Illuminate\\Routing\\Controller:45", "Illuminate\\Routing\\ControllerDispatcher:262", "Illuminate\\Routing\\Route:205", "Illuminate\\Routing\\Route:721", "Illuminate\\Routing\\Router:128", "Illuminate\\Pipeline\\Pipeline:47", "App\\Http\\Middleware\\SetLocale:167", "Illuminate\\Pipeline\\Pipeline:50" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select count(*) as aggregate fromcms_folderswhereparent_idis not null andparent_id= 'cab2b68f-d6bd-457f-9a21-cb8e9ed8abf3' andcms_folders.domain_id= '19d49344-1173-4ae1-b2fd-500632db0ec6' andcms_folders.deleted_atis null" } }, { "id": "0c4985a4754d397e", "name": "mysql at CmsFolderService:45", "start_time": 1674065140.43718, "end_time": 1674065140.4404101, "metadata": { "backtrace": [ "App\\Services\\CmsFolderService:45", "App\\Http\\Controllers\\Api\\CmsFolderController:54", "Illuminate\\Routing\\Controller:45", "Illuminate\\Routing\\ControllerDispatcher:262", "Illuminate\\Routing\\Route:205", "Illuminate\\Routing\\Route:721", "Illuminate\\Routing\\Router:128", "Illuminate\\Pipeline\\Pipeline:47", "App\\Http\\Middleware\\SetLocale:167", "Illuminate\\Pipeline\\Pipeline:50" ] }, "namespace": "remote", "sql": { "database_type": "mysql", "sanitized_query": "select * fromcms_folderswhereparent_idis not null andparent_id= 'cab2b68f-d6bd-457f-9a21-cb8e9ed8abf3' andcms_folders.domain_id= '19d49344-1173-4ae1-b2fd-500632db0ec6' andcms_folders.deleted_atis null order bynameasc,updated_at desc limit 100 offset 0" } } ], "annotations": { "Framework": "Laravel 8.80.0", "PHP Version": "8.1.10" }, "http": { "request": { "url": "https://dev.mydomain.com/api/cms-folders", "method": "GET", "client_ip": "10.1.0.248" }, "response": { "status": 200 } } }

@adrianpaiva1
Copy link
Contributor Author

Looks like it's happening here, in DatabaseQueryCollector

image

when using route model binding for me

image

@adrianpaiva1
Copy link
Contributor Author

image

Removing this '?' in Collectors/Backtracker.php solves the issue for me, should I submit a PR to change this to an empty string? since ? is not supported in segment names.

@viezel
Copy link
Contributor

viezel commented Jan 19, 2023

Removing this '?' in Collectors/Backtracker.php solves the issue for me, should I submit a PR to change this to an empty string? since ? is not supported in segment names.

Yes please

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants