{"id":15348117,"url":"https://github.com/ironcore864/trace-reconstruct","last_synced_at":"2026-03-07T10:30:18.965Z","repository":{"id":73865995,"uuid":"240677352","full_name":"IronCore864/trace-reconstruct","owner":"IronCore864","description":null,"archived":false,"fork":false,"pushed_at":"2020-02-20T11:13:50.000Z","size":8,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-04-15T02:01:08.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/IronCore864.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":"2020-02-15T09:30:18.000Z","updated_at":"2024-06-19T07:48:40.910Z","dependencies_parsed_at":null,"dependency_job_id":"c106fbb4-298e-46d4-920b-f886603f1620","html_url":"https://github.com/IronCore864/trace-reconstruct","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/IronCore864%2Ftrace-reconstruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftrace-reconstruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftrace-reconstruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IronCore864%2Ftrace-reconstruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IronCore864","download_url":"https://codeload.github.com/IronCore864/trace-reconstruct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239898461,"owners_count":19715212,"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":[],"created_at":"2024-10-01T11:44:56.812Z","updated_at":"2026-03-07T10:30:18.924Z","avatar_url":"https://github.com/IronCore864.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Trace Reconstruct from Logs\n\n## Dependency\n\ngo version go1.13.4 darwin/amd64\n\n## Build\n\n```\ngo build\n```\n\n## Run\n\n```\n./trace-reconstruct\n```\n\n## Explanation\n\n- there is an error in the documentation, which is the \"span\" in the example output, which does not correspond to the example input, caused a little confusion, please update :)\n- total time taken: 2 hour (thinking + coding), plus 10 min (documentation)\n- don't want to spend more time, so lots of things not implemented, but the core is there\n- didn't pass traces-evaluator, it might be related to input format, but tested locally\n\nFirst test case used is the example input in the doc;\n\nSecond test case is what I recovered from the output of the traces-evaluator:\n\n```\n2020-02-15T08:39:33.044Z 2020-02-15T08:39:33.123Z 5ry2k4vf service5 vlkh4jn2-\u003ev55vu7ab\n2020-02-15T08:39:32.965Z 2020-02-15T08:39:33.285Z 5ry2k4vf service3 mym6zdfr-\u003evlkh4jn2\n2020-02-15T08:39:33.600Z 2020-02-15T08:39:33.602Z 5ry2k4vf service2 jl2dyo5v-\u003ewyqewehm\n2020-02-15T08:39:33.600Z 2020-02-15T08:39:33.603Z 5ry2k4vf service1 oltcykrh-\u003ejl2dyo5v\n2020-02-15T08:39:33.598Z 2020-02-15T08:39:33.603Z 5ry2k4vf service6 yb2bnwbx-\u003eoltcykrh\n2020-02-15T08:39:33.543Z 2020-02-15T08:39:33.797Z 5ry2k4vf service9 mym6zdfr-\u003eyb2bnwbx\n2020-02-15T08:39:34.656Z 2020-02-15T08:39:34.938Z 5ry2k4vf service7 mym6zdfr-\u003eznjk6pze\n2020-02-15T08:39:35.073Z 2020-02-15T08:39:35.088Z 5ry2k4vf service1 53egpuym-\u003ebmmyuw5a\n2020-02-15T08:39:35.029Z 2020-02-15T08:39:35.093Z 5ry2k4vf service7 mym6zdfr-\u003e53egpuym\n2020-02-15T08:39:32.811Z 2020-02-15T08:39:35.561Z 5ry2k4vf service9 null-\u003emym6zdfr\n```\n\nThe timestamps showed when I finished my code and started testing.\n\n## What is Missing:\n- very basic input validation\n- no optional stderr for statistics\n- no implementation of the 20s pending entries, treated as orphan line if they came later than the root \"null-\u003exxx\"\n- no buffer implemented\n\n## Todo\n\n- add UT\n- add more input validation to ignore malformed input lines\n- add statistics about orphan lines and other required stuff\n- the get all callers part might be improved performance wise, but probably no need, since typically in a trace there will only be around 20 logs or so\n- implement 20s pending: set a timer when receiving first entry of the trace, when \"null-\u003exxx\" is received, wait till 20s, then start doing trace reconstruct. Here I have already given an initial thought: might need to add another field to record first entry's time, then need another go routine to check timer, might need lock on the buffer map. To show you my capabilities of go routine and communication between routines, see: https://github.com/IronCore864/go-courses-uni-california-irvine/blob/master/ConcurrencyInGo/Week4/philosopher/main.go\n- another simple solutoin would be to use redis and simply set TTL to 20s\n- buffer: delete processed trace, but I see no need to limit the size: even if we got 1b req/day, in 20s window there are maximum 200k lines of logs, which is not much.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironcore864%2Ftrace-reconstruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fironcore864%2Ftrace-reconstruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fironcore864%2Ftrace-reconstruct/lists"}