{"id":19854023,"url":"https://github.com/wall-brew-co/keg","last_synced_at":"2025-05-02T01:30:27.212Z","repository":{"id":39584619,"uuid":"308023890","full_name":"Wall-Brew-Co/keg","owner":"Wall-Brew-Co","description":"A Clojure library built to tap functions and pour data","archived":true,"fork":false,"pushed_at":"2025-01-05T17:56:27.000Z","size":1812,"stargazers_count":2,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-05T10:32:07.454Z","etag":null,"topics":["apm","clojure","metrics","performance"],"latest_commit_sha":null,"homepage":null,"language":"Clojure","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Wall-Brew-Co.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-28T13:24:30.000Z","updated_at":"2025-01-05T17:56:40.000Z","dependencies_parsed_at":"2024-07-07T04:23:38.669Z","dependency_job_id":"4bf894cc-8ff6-4eb4-994b-c61103fd564a","html_url":"https://github.com/Wall-Brew-Co/keg","commit_stats":{"total_commits":50,"total_committers":3,"mean_commits":"16.666666666666668","dds":0.48,"last_synced_commit":"182764069415120a0bc8aea4f74a76ef0f10df54"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wall-Brew-Co%2Fkeg","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wall-Brew-Co%2Fkeg/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wall-Brew-Co%2Fkeg/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Wall-Brew-Co%2Fkeg/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Wall-Brew-Co","download_url":"https://codeload.github.com/Wall-Brew-Co/keg/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251969236,"owners_count":21673180,"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":["apm","clojure","metrics","performance"],"created_at":"2024-11-12T14:08:21.869Z","updated_at":"2025-05-02T01:30:27.203Z","avatar_url":"https://github.com/Wall-Brew-Co.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# keg\n\nA Wall Brew infrastructure library to monitor function performance in clojure applications.\nkeg measures the time it takes functions to execute, uses `clojure/tools.logging` to emit debug statements.\n\nThis repository follows the guidelines and standards of the [Wall Brew Open Source Policy.](https://github.com/Wall-Brew-Co/open-source \"Our open source guidelines\")\n\n## Deprecation Notice\n\nWith the advent of [OpenTracing](https://opentracing.io/) and [OpenTelemetry](https://opentelemetry.io/), cross-language and cross-platform performance monitoring and logging has been solved in a much more meaningful and generally applicable way.\nWall Brew's internal software has begun shifting to these new standards, and we no longer use keg in day-to-day operations.\nYou are free to continue using published versions of this library, fork this repository for your own needs, or use any of the code within.\nAs of 2025-01-05, this repository will be archived and Wall Brew will no longer support Keg.\n\n## Dependency\n\nAdd the library to your `:dependencies`:\n\n```clojure\n[com.wallbrew/keg \"1.0.0\"]\n```\n\n## Usage\n\nFirst, require keg in your namespace:\n\n```clojure\n(:require [keg.core :as keg])\n```\n\nThen, tap the function definitions you want runtime statistics for:\n\n```clojure\n(defn my-awesome-function\n  [arg1 arg2]\n  (+ arg1 arg2))\n\n(keg/tap #'my-awesome-function)\n```\n\nThis creates a hook for your function.\nEvery time it executes, it'll log some data via `clojure/tools.logging` through whatever logging provider your project uses.\nBe sure to prefix the function name with `#'` otherwise you'll encounter errors that state your functions are unnamed modules in the DynamicClassLoader.\n\nFor example:\n\n```clojure\n(my-awesome-function 3 5)\n;=\u003e 2020-10-28T17:21:25.959Z my-machine-id DEBUG [my-app.core/my-awesome-function] - {:function-name my-awesome-function, :runtime 1}\n```\n\nIf you want pour extra data, you can use some of the provided formatters:\n\n```clojure\n(keg/tap #'my-awesome-function keg/pour-runtime-and-args)\n(my-awesome-function 3 5)\n;=\u003e 2020-10-28T17:21:25.959Z my-machine-id DEBUG [my-app.core/my-awesome-function] - {:function-name my-awesome-function, :runtime 1, :arguments [3 5]}\n\n(keg/tap #'my-awesome-function keg/pour-runtime-args-and-return)\n(my-awesome-function 3 5)\n;=\u003e 2020-10-28T17:21:25.959Z my-machine-id DEBUG [my-app.core/my-awesome-function] - {:function-name my-awesome-function, :runtime 1, :arguments [3 5], :return-value 8}\n```\n\nOr, you can always write your own:\n\n```clojure\n(defn my-awesome-formatter\n  [_function-name runtime _return \u0026 args]\n  {:app-port (System/getenv \"PORT\")\n   :runtime  runtime\n   :args     args})\n\n(keg/tap #'my-awesome-function my-awesome-formatter)\n(my-awesome-function 3 5)\n;=\u003e 2020-10-28T17:21:25.959Z my-machine-id DEBUG [my-app.core/my-awesome-function] - {:app-port 8080, :runtime 1, :args [3 5]}\n```\n\nWhen writing your own formatters, please note the following:\n\n- Arguments are always received in this order: `function-name runtime function-return args`\n- The formatter can return text, or a map for structured logging\n- Care should be used when logging arguments and/or return values in production environments\n- All run times are assumed to be in milliseconds\n\n## License\n\nCopyright - [Wall Brew Co](https://wallbrew.com/)\n\nThis software is provided for free, public use as outlined in the [MIT License](https://github.com/Wall-Brew-Co/keg/blob/master/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwall-brew-co%2Fkeg","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwall-brew-co%2Fkeg","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwall-brew-co%2Fkeg/lists"}