{"id":45186477,"url":"https://github.com/gosuperscript/axiom-tracing","last_synced_at":"2026-04-02T15:04:51.901Z","repository":{"id":337606842,"uuid":"1154367691","full_name":"gosuperscript/axiom-tracing","owner":"gosuperscript","description":null,"archived":false,"fork":false,"pushed_at":"2026-02-10T11:12:46.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-10T16:04:48.448Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/gosuperscript.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-10T10:01:50.000Z","updated_at":"2026-02-10T11:12:47.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/gosuperscript/axiom-tracing","commit_stats":null,"previous_names":["gosuperscript/axiom-tracing"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/gosuperscript/axiom-tracing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosuperscript%2Faxiom-tracing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosuperscript%2Faxiom-tracing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosuperscript%2Faxiom-tracing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosuperscript%2Faxiom-tracing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gosuperscript","download_url":"https://codeload.github.com/gosuperscript/axiom-tracing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gosuperscript%2Faxiom-tracing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29648434,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-20T09:27:29.698Z","status":"ssl_error","status_checked_at":"2026-02-20T09:26:12.373Z","response_time":59,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":[],"created_at":"2026-02-20T11:02:39.648Z","updated_at":"2026-02-20T11:02:40.125Z","avatar_url":"https://github.com/gosuperscript.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# axiom-tracing\n\nOpt-in resolution tracing for [gosuperscript/axiom](https://github.com/gosuperscript/axiom). Decorates `DelegatingResolver` to build a tree-shaped trace that mirrors the recursive resolution call stack, capturing timing, outcomes, and resolver-contributed metadata on each node.\n\n## Installation\n\n```bash\ncomposer require gosuperscript/axiom-tracing\n```\n\n## Usage\n\n### Conditional tracing with callback\n\n```php\nuse Superscript\\Axiom\\Resolvers\\DelegatingResolver;\nuse Superscript\\Axiom\\Tracing\\Tracing;\nuse Superscript\\Axiom\\Tracing\\TracedResult;\nuse Superscript\\Axiom\\Tracing\\TracingResolver;\n\n$resolver = Tracing::wrap(\n    new DelegatingResolver([...]),\n    enabled: config('axiom.tracing', false),\n);\n\n// Register a callback — fires on every top-level resolution\nif ($resolver instanceof TracingResolver) {\n    $resolver-\u003eonTrace(function (TracedResult $traced) {\n        Log::debug('Axiom resolution', ['trace' =\u003e $traced-\u003edump()]);\n    });\n}\n\n// Calling code is unchanged\n$result = $resolver-\u003eresolve($source);\n```\n\n### Explicit trace retrieval\n\n```php\nuse Superscript\\Axiom\\Tracing\\TracingResolver;\n\n$tracer = new TracingResolver($delegatingResolver);\n\n$traced = $tracer-\u003etraced($source);\n$traced-\u003eresult;  // Result\u003cOption\u003cT\u003e\u003e\n$traced-\u003etrace;   // ResolutionTrace tree\n$traced-\u003edump();  // formatted string\n```\n\n### Extracting metadata from a trace\n\n```php\n// Collect all values for a key across the entire tree\n$httpExchanges = $traced-\u003etrace-\u003ecollect('http_response');\n\n// Walk the tree manually\nforeach ($traced-\u003etrace-\u003echildren() as $child) {\n    $child-\u003egetMetadata('http_response');\n}\n```\n\n### Production use (flat inspector, no tracing)\n\nFor extracting resolver metadata without full tracing overhead:\n\n```php\nuse Superscript\\Axiom\\Tracing\\ResolutionContext;\nuse Superscript\\Axiom\\ResolutionInspector;\n\n$context = new ResolutionContext();\n$resolver-\u003einstance(ResolutionInspector::class, $context);\n\n$result = $resolver-\u003eresolve($source);\n$httpResponse = $context-\u003eget('http_response');\n```\n\n## Components\n\n| Component | Purpose |\n|---|---|\n| `ResolutionContext` | Flat key-value `ResolutionInspector` for production metadata extraction |\n| `ResolutionTrace` | Tree node with children, metadata, and recursive `collect()` |\n| `TracingResolutionInspector` | Tree-aware inspector routing annotations to the current trace node |\n| `TracingResolver` | Decorator intercepting every `resolve()` call to build the trace tree |\n| `TracedResult` | Pairs a `Result` with its `ResolutionTrace` tree |\n| `TraceFormatter` | Renders trace trees as human-readable indented strings |\n| `Tracing` | Factory with `wrap()` for conditional decoration |\n\n## Example output\n\n```\nTypeDefinition [NumberType] — ok, value: 150, 52ms\n└── InfixExpression [*] — ok, value: 150, 51ms\n    ├── SymbolSource [base_rate] — ok, value: 100, 3ms\n    │   └── StaticSource [static(int)] — ok, value: 100, 0.01ms\n    └── InfixExpression [+] — ok, value: 1.5, 45ms\n        ├── StaticSource [static(float)] — ok, value: 0.5, 0.01ms\n        └── StaticSource [static(int)] — ok, value: 1, 0.01ms\n```\n\n## Testing\n\n```bash\ncomposer install\nvendor/bin/phpunit\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgosuperscript%2Faxiom-tracing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgosuperscript%2Faxiom-tracing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgosuperscript%2Faxiom-tracing/lists"}