{"id":15010420,"url":"https://github.com/studistcorporation/sleepydog","last_synced_at":"2025-04-09T18:34:41.403Z","repository":{"id":208213489,"uuid":"720980942","full_name":"StudistCorporation/sleepydog","owner":"StudistCorporation","description":"Clojure library for tracing (possibly async) applications with Datadog.","archived":false,"fork":false,"pushed_at":"2025-01-08T23:50:15.000Z","size":35868,"stargazers_count":12,"open_issues_count":7,"forks_count":0,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-04-09T11:49:44.422Z","etag":null,"topics":["async","clj","clojure","datadog","distributed-tracing","hacktoberfest","instrumentation","o11y","observability","terraform-managed","tracing"],"latest_commit_sha":null,"homepage":"https://studist.jp","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/StudistCorporation.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2023-11-20T05:26:28.000Z","updated_at":"2024-12-17T06:13:18.000Z","dependencies_parsed_at":"2025-02-15T13:32:52.014Z","dependency_job_id":"f5d08a10-81fa-450a-9abc-5ae5b2a9e69b","html_url":"https://github.com/StudistCorporation/sleepydog","commit_stats":null,"previous_names":["studistcorporation/sleepydog"],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StudistCorporation%2Fsleepydog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StudistCorporation%2Fsleepydog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StudistCorporation%2Fsleepydog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/StudistCorporation%2Fsleepydog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/StudistCorporation","download_url":"https://codeload.github.com/StudistCorporation/sleepydog/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248088287,"owners_count":21045679,"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":["async","clj","clojure","datadog","distributed-tracing","hacktoberfest","instrumentation","o11y","observability","terraform-managed","tracing"],"created_at":"2024-09-24T19:34:08.579Z","updated_at":"2025-04-09T18:34:41.367Z","avatar_url":"https://github.com/StudistCorporation.png","language":"Clojure","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sleepy Dog\n\n[![Build Status](https://github.com/studistcorporation/sleepydog/actions/workflows/test.yaml/badge.svg?event=push)](https://github.com/studistcorporation/sleepydog/actions) [![Clojars Project](https://img.shields.io/clojars/v/jp.studist/sleepydog.svg)](https://clojars.org/jp.studist/sleepydog)\n\nClojure library for tracing (possibly async) applications with Datadog.\n\n## Installation\n\nAvailable on Clojars.\n\n```clj\n[jp.studist/sleepydog \"0.2.0\"]\n```\n\n## Usage\n\nThe public API is in the `sleepy.dog` namespace.\n\n### `defn-traced`\n\nA drop-in replacement for Clojure's `defn` that instruments the function in question as a new Datadog span.\n\n### `wrap-ring-trace`\n\nA ring middleware that automatically instruments server requests.\n\n### `with-tracing \"op-name\"`\n\nA macro that instruments the given body as a span labelled as operation \"op-name\".\n\n### `set-resource!`\n\nSets the resource (subject) of the current span's operation.\n\n```clj\n(with-tracing \"s3-upload\"\n  (set-resource! \"foo/bar/baz.jpg\")\n  ,,, ; prepare upload\n  (.putObject client put-request))\n```\n\n### `http-headers`\n\nUtility function that builds Datadog headers for distributed tracing. By adding these headers to any outgoing (upstream) request, it's possible to connect traces across services.\n\n```clj\n;; (:require [sleepy.dog :as datadog])\n(merge (datadog/http-headers) headers)\n```\n\n### `report-error!`\n\nUsed to manually report caught exceptions (without relying on the automatic reporting from `with-tracing` or `defn-traced`). This can be useful for example in a Ring handler that catches all escaped exceptions and responds with a well-formed 500 error.\n\nIf you want to mark an entire request as \"errored\", then combine this with `root-of` to mark the root span as error.\n\n```clj\n(defn wrap-exception\n  [handler]\n  (fn exception-catcher\n    [request]\n    (try\n      (handler request)\n      (catch Throwable ex\n        (let [span (datadog/active-span!)]\n          (datadog/report-error! span ex)\n          (when-let [root (datadog/root-of span)]\n            (datadog/report-error! root ex)))\n        {:status 500 :body (.getMessage ex)}))))\n```\n\n### Tracing Carmine\n\nYou can enable tracing for the [Carmine Redis library](https://github.com/taoensso/carmine) by using `sleepy.dog.carmine/trace-carmine!`. The traces will be reported mimicking the way how Datadog auto-instruments Jedis or the Ruby redis gem.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudistcorporation%2Fsleepydog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstudistcorporation%2Fsleepydog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstudistcorporation%2Fsleepydog/lists"}