{"id":15137763,"url":"https://github.com/alexrios/lmotelfy","last_synced_at":"2025-10-23T13:30:53.932Z","repository":{"id":142455170,"uuid":"531356321","full_name":"alexrios/LMOtelFY","owner":"alexrios","description":"Automagically insert Open Telemetry spans in your codebase.","archived":false,"fork":false,"pushed_at":"2022-09-03T02:34:08.000Z","size":16,"stargazers_count":19,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-07T14:02:02.886Z","etag":null,"topics":["ast","cli","go","golang","open-telemetry","open-telemetry-go","otel","span"],"latest_commit_sha":null,"homepage":"","language":"Go","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/alexrios.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}},"created_at":"2022-09-01T04:00:58.000Z","updated_at":"2025-01-31T11:01:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"af232e4b-f91e-43cc-8e07-2f8543a19340","html_url":"https://github.com/alexrios/LMOtelFY","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexrios%2FLMOtelFY","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexrios%2FLMOtelFY/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexrios%2FLMOtelFY/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexrios%2FLMOtelFY/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexrios","download_url":"https://codeload.github.com/alexrios/LMOtelFY/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":237834596,"owners_count":19373756,"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":["ast","cli","go","golang","open-telemetry","open-telemetry-go","otel","span"],"created_at":"2024-09-26T07:01:54.261Z","updated_at":"2025-10-23T13:30:48.636Z","avatar_url":"https://github.com/alexrios.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LMOtelFY\n\nLet Me OTel(Open Telemetry) For You\n\n### What this program does?\nIt will look for two situations:\n - Exported functions that have `context.Context` as a parameter.\n - HTTP handlers\n \nAnd create:\n- `Start()` new span made by \"`package`.`function name`\".\n- defer the span `End()`\n- call `span.RecordError(err)` when error is handled in the function.\n- Add the imports needed\n\n##### Examples\nThis code:\n```go\npakage samples\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc H(w http.ResponseWriter, r *http.Request) {\n\t ...\n\tif err != nil {\n\t\tlog.Println(err.Error())\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n ...\n}\n\nfunc C(ctx context.Context) error {\n\t...\n\tif err != nil {\n\t\treturn err\n\t}\n\t...\n}\n```\n\nwill turn into this:\n```go \npakage samples\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"github.com/example/extensions/telemetry\" // New import needed\n\t\"log\"\n\t\"net/http\"\n)\n\nfunc H(w http.ResponseWriter, r *http.Request) {\n\tctx, span := telemetry.FromContext(ctx).Start(ctx, \"samples.H\")\n\tdefer span.End()\n\t...\n\tif err != nil {\n\t\tspan.RecordError(err)\n\t\tlog.Println(err.Error())\n\t\tw.WriteHeader(http.StatusUnauthorized)\n\t\treturn\n\t}\n  ...\n}\n\nfunc C(ctx context.Context) error {\n\tctx, span := telemetry.FromContext(ctx).Start(ctx, \"samples.C\")\n\tdefer span.End()\n\t...\n\tif err != nil {\n\t\tspan.RecordError(err)\n\t\treturn err\n\t}\n  ...\n}\n```\n\n### Params\n- `--dry-run`\n  - when dry run is true the program will modify the files found\n  - default: true\n- `--path`\n  - What path to read?\n  - default: \".\"\n- `--import`\n  - Where is your telemetry functions?\n  - default: \"github.com/example/extensions/telemetry\"\n- `--allowed-dirs`\n  - The list of dir fragments allowed\n  - default: \"samples\"\n- `--disallowed-dirs`\n  - The list of dir fragments disallowed\n  - default: \".\"","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexrios%2Flmotelfy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexrios%2Flmotelfy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexrios%2Flmotelfy/lists"}