{"id":16592397,"url":"https://github.com/hauleth/plug_telemetry_server_timing","last_synced_at":"2025-03-21T13:31:28.274Z","repository":{"id":46821644,"uuid":"213612935","full_name":"hauleth/plug_telemetry_server_timing","owner":"hauleth","description":"Plug for providing Telemetry metrics within browser DevTools","archived":false,"fork":false,"pushed_at":"2024-03-19T13:07:41.000Z","size":80,"stargazers_count":18,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-18T01:51:16.173Z","etag":null,"topics":["elixir","elixir-plug","hacktoberfest","metrics","plug","server-timing","telemetry"],"latest_commit_sha":null,"homepage":"https://hex.pm/packages/plug_telemetry_server_timing","language":"Elixir","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/hauleth.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","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},"funding":{"github":["hauleth"]}},"created_at":"2019-10-08T10:25:39.000Z","updated_at":"2024-09-18T11:01:14.000Z","dependencies_parsed_at":"2024-10-28T10:27:23.814Z","dependency_job_id":"55eaf7f5-575c-447d-bfb3-4bd6428f4aa3","html_url":"https://github.com/hauleth/plug_telemetry_server_timing","commit_stats":{"total_commits":14,"total_committers":2,"mean_commits":7.0,"dds":0.0714285714285714,"last_synced_commit":"b59303905b24935eb072ec516ac3c6e7eb2356bb"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fplug_telemetry_server_timing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fplug_telemetry_server_timing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fplug_telemetry_server_timing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hauleth%2Fplug_telemetry_server_timing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hauleth","download_url":"https://codeload.github.com/hauleth/plug_telemetry_server_timing/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244806099,"owners_count":20513381,"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":["elixir","elixir-plug","hacktoberfest","metrics","plug","server-timing","telemetry"],"created_at":"2024-10-11T23:20:47.727Z","updated_at":"2025-03-21T13:31:28.041Z","avatar_url":"https://github.com/hauleth.png","language":"Elixir","funding_links":["https://github.com/sponsors/hauleth"],"categories":[],"sub_categories":[],"readme":"# Plug.Telemetry.ServerTiming\n\n\u003c!-- BEGIN --\u003e\n\nThis library provides support for [`Server-Timing`][st] header in Plug\napplications by exposing [Telemetry][tm] events as metrics in HTTP headers. This\nallows developers to use their's browser DevTools to display server metrics in\nreadable way.\n\n## Installation\n\nThe package can be installed by adding `plug_server_timing` to your list of\ndependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:plug_telemetry_server_timing, \"~\u003e 0.3.0\"}\n  ]\nend\n```\n\nThen add `Plug.ServerTiming` to your pipeline **BEFORE** any `Plug.Telemetry`\ndefinitions:\n\n```elixir\nplug Plug.Telemetry.ServerTiming\nplug Plug.Telemetry, event_prefix: [:my, :plug]\n```\n\nAnd then you need to `install/1` metrics you will want to see in the DevTools:\n\n```elixir\nPlug.Telemetry.ServerTiming.install([\n  {[:my, :plug, :stop], :duration}\n])\n```\n\nNow when you will open given page in [browsers with support for\n`Server-Timing`][caniuse] you will be able to see the data in DevTools, example\nin Google Chrome:\n\n![Google Chrome DevTools image example](assets/example.png)\n\n### Important\n\nYou need to place this plug **BEFORE** `Plug.Telemetry` call as otherwise it\nwill not see it's events (`before_send` callbacks are called in reverse order\nof declaration, so this one need to be added before `Plug.Telemetry` one.\n\n## Caveats\n\nThis will not respond with events that happened in separate processes, only\nevents that happened in the Plug process will be recorded.\n\n### WARNING\n\nCurrent specification of `Server-Timing` do not provide a way to specify event\nstart time, which mean, that the data displayed in the DevTools isn't trace\nreport (like the content of the \"regular\" HTTP timings) but raw dump of the data\ndisplayed as a bars. This can be a little bit confusing, but right now there is\nnothing I can do about it.\n\n[caniuse]: https://caniuse.com/#feat=server-timing\n[st]: https://w3c.github.io/server-timing/#the-server-timing-header-field\n[tm]: https://github.com/beam-telemetry/telemetry\n\n\u003c!-- END --\u003e\n\n## License\n\n[MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fplug_telemetry_server_timing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhauleth%2Fplug_telemetry_server_timing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhauleth%2Fplug_telemetry_server_timing/lists"}