{"id":15018833,"url":"https://github.com/fujiwara/aws-xray","last_synced_at":"2025-04-09T19:43:24.425Z","repository":{"id":32577964,"uuid":"137371053","full_name":"fujiwara/AWS-XRay","owner":"fujiwara","description":"AWS X-Ray tracing library for Perl5","archived":false,"fork":false,"pushed_at":"2022-05-11T03:51:03.000Z","size":93,"stargazers_count":6,"open_issues_count":2,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-23T21:45:49.375Z","etag":null,"topics":["aws","perl","x-ray"],"latest_commit_sha":null,"homepage":"","language":"Perl","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fujiwara.png","metadata":{"files":{"readme":"README.md","changelog":"Changes","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-06-14T14:45:47.000Z","updated_at":"2023-02-16T08:41:36.000Z","dependencies_parsed_at":"2022-08-08T22:00:36.417Z","dependency_job_id":null,"html_url":"https://github.com/fujiwara/AWS-XRay","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2FAWS-XRay","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2FAWS-XRay/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2FAWS-XRay/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fujiwara%2FAWS-XRay/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fujiwara","download_url":"https://codeload.github.com/fujiwara/AWS-XRay/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248101483,"owners_count":21047978,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","perl","x-ray"],"created_at":"2024-09-24T19:52:31.011Z","updated_at":"2025-04-09T19:43:24.403Z","avatar_url":"https://github.com/fujiwara.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# NAME\n\nAWS::XRay - AWS X-Ray tracing library\n\n# SYNOPSIS\n\n    use AWS::XRay qw/ capture /;\n\n    capture \"myApp\", sub {\n        capture \"remote\", sub {\n            # do something ...\n            capture \"nested\", sub {\n                # ...\n            };\n        };\n        capture \"myHTTP\", sub {\n            my $segment = shift;\n            # ...\n            $segment-\u003e{http} = { # modify segment document\n                request =\u003e {\n                    method =\u003e \"GET\",\n                    url    =\u003e \"http://localhost/\",\n                },\n                response =\u003e {\n                    status =\u003e 200,\n                },\n            };\n        };\n    };\n\n    my $header;\n    capture \"source\", sub {\n        my $segment = shift;\n        $header = $segment-\u003etrace_header;\n    };\n    capture_from $header, \"dest\", sub {\n        my $segment = shift;  # is a child of \"source\" segment\n        # ...\n    };\n\n# DESCRIPTION\n\nAWS::XRay is a tracing library with AWS X-Ray.\n\nAWS::XRay sends segment data to [AWS X-Ray Daemon](https://docs.aws.amazon.com/xray/latest/devguide/xray-daemon.html).\n\n# FUNCTIONS\n\n## new\\_trace\\_id\n\nGenerate a Trace ID. (e.g. \"1-581cf771-a006649127e371903a2de979\")\n\n[Document](https://docs.aws.amazon.com/xray/latest/devguide/xray-api-sendingdata.html#xray-api-traceids)\n\n## capture($name, $code)\n\ncapture() executes $code-\u003e($segment) and send the segment document to X-Ray daemon.\n\n$segment is a AWS::XRay::Segment object.\n\nWhen $AWS::XRay::TRACE\\_ID is not set, generates TRACE\\_ID automatically.\n\nWhen capture() called from other capture(), $segment is a sub segment document.\n\nSee also [AWS X-Ray Segment Documents](https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html).\n\n## capture\\_from($header, $name, $code)\n\ncapture\\_from() parses the trace header and capture the $code with sub segment of header's segment.\n\n## parse\\_trace\\_header($header)\n\n    my ($trace_id, $segment_id) = parse_trace_header($header);\n\nParse a trace header (e.g. \"Root=1-5759e988-bd862e3fe1be46a994272793;Parent=53995c3f42cd8ad8\").\n\n## add\\_capture($package, $method1\\[, $method2, ...\\])\n\nadd\\_capture() adds a capture to package::method.\n\n    AWS::XRay-\u003eadd_capture(\"MyApp::Model\", \"foo\", \"bar\");\n\nThe segments of these captures are named as \"MyApp::Model\".\nThese segments include metadata \"method\": \"foo\" or \"bar\".\n\n# CONFIGURATION\n\n## sampling\\_rate($rate)\n\nSet/Get a sampling rate for capture().\n\n    AWS::XRay-\u003esampling_rate(0.1); # 10% sampling\n\n$rate is allowed a float value between 0 and 1.\n\n0 means disable tracing.\n1 means all of capture() are traced.\n\nWhen capture\\_from() called with a trace header includes \"Sampled=1\", all of followed capture() are traced.\n\n## sampler($code)\n\nSet/Get a code ref to sample for capture().\n\n    AWS::XRay-\u003esampler(sub {\n        if ($some_condition) {\n           return 1;\n        } else {\n           return 0;\n        }\n    });\n\n## auto\\_flush($mode)\n\nSet/Get auto flush mode.\n\nWhen $mode is 1 (default), segment data will be sent to xray daemon immediately after capture() called.\n\nWhen $mode is 0, segment data are buffered in memory. You should call AWS::XRay-\u003esock-\u003eflush() to send the buffered segment data or call AWS::XRay-\u003esock-\u003eclose() to discard the buffer.\n\n## AWS\\_XRAY\\_DAEMON\\_ADDRESS environment variable\n\nSet the host and port of the X-Ray daemon. Default 127.0.0.1:2000\n\n## $AWS::XRay::CROAK\\_INVALID\\_NAME\n\nWhen set to 1 (default 0), capture() will raise exception if a segment name is invalid.\n\nSee https://docs.aws.amazon.com/xray/latest/devguide/xray-api-segmentdocuments.html\n\n\u003e name – The logical name of the service that handled the request, up to 200 characters.\n\u003e For example, your application's name or domain name.\n\u003e Names can contain Unicode letters, numbers, and whitespace, and the following symbols: \\_, ., :, /, %, \u0026, #, =, +, \\\\, -, @\n\n# LICENSE\n\nCopyright (C) FUJIWARA Shunichiro.\n\nThis library is free software; you can redistribute it and/or modify\nit under the same terms as Perl itself.\n\n# AUTHOR\n\nFUJIWARA Shunichiro \u003cfujiwara.shunichiro@gmail.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujiwara%2Faws-xray","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffujiwara%2Faws-xray","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffujiwara%2Faws-xray/lists"}