{"id":15694277,"url":"https://github.com/dmuhs/falcon-stats","last_synced_at":"2025-04-30T14:44:04.829Z","repository":{"id":22681298,"uuid":"96802903","full_name":"dmuhs/falcon-stats","owner":"dmuhs","description":"A falcon middleware for gathering request-response statistics","archived":false,"fork":false,"pushed_at":"2024-05-21T19:43:32.000Z","size":31,"stargazers_count":7,"open_issues_count":6,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-13T03:49:23.431Z","etag":null,"topics":["api","falcon","falcon-stats","middleware","mysql","rest","rest-api","statistics"],"latest_commit_sha":null,"homepage":"","language":"Python","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/dmuhs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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}},"created_at":"2017-07-10T17:18:18.000Z","updated_at":"2021-01-25T19:00:24.000Z","dependencies_parsed_at":"2024-10-24T01:19:54.092Z","dependency_job_id":"34ecdb88-995d-4675-bb1d-847964bb1211","html_url":"https://github.com/dmuhs/falcon-stats","commit_stats":{"total_commits":38,"total_committers":2,"mean_commits":19.0,"dds":"0.26315789473684215","last_synced_commit":"f45f134c86dcdcc73f4bf31fd639962854b721f3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Ffalcon-stats","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Ffalcon-stats/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Ffalcon-stats/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dmuhs%2Ffalcon-stats/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dmuhs","download_url":"https://codeload.github.com/dmuhs/falcon-stats/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251723243,"owners_count":21633112,"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":["api","falcon","falcon-stats","middleware","mysql","rest","rest-api","statistics"],"created_at":"2024-10-03T18:55:41.334Z","updated_at":"2025-04-30T14:44:04.799Z","avatar_url":"https://github.com/dmuhs.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Falcon Stats\n[![Build Status](https://travis-ci.org/dmuhs/falcon-stats.svg?branch=master)](https://travis-ci.org/dmuhs/falcon-stats)\n[![PyPI](https://img.shields.io/pypi/status/falcon-stats.svg)](https://pypi.python.org/pypi/falcon-stats)\n[![PyPI](https://img.shields.io/pypi/v/falcon-stats.svg)](https://pypi.python.org/pypi/falcon-stats)\n[![PyPI](https://img.shields.io/pypi/format/falcon-stats.svg)](https://pypi.python.org/pypi/falcon-stats)\n\n\n`falcon-stats` is a simple usage statistics middleware for the [Falcon REST framework](https://falconframework.org/). It should primarily enable later analysis that separately gets relevant data from the DB.\n\n## Data Collection\n*Falcon Stats* gathers data on incoming requests and their processed responses. Currently the following features are saved:\n\n- Response Timestamp\n- Processing Time between Request and Response\n- Request Method\n- User Agent\n- Request URI (domain, endpoint and query string)\n- Remote IP (closest to the server)\n- Request Content-Type\n- Response Status\n- Request Content Length\n\nNote that logging and database access add overhead to the processing time. Furthermore it will add a few milliseconds on every response.\n\n## Installation\n... is as easy as\n\n```\npip install falcon-stats\n```\n\nInstallation assumes you have the packages found in *requirements.txt* installed. Please note the development build of SQLAlchemy that is pulled from the official git repository.\n\n## Usage\nIn your main falcon file import the `FalconStatsMiddleware` and add it to the middleware list of your API instance. That's it.\n\n```python\nfrom falconstats import FalconStatsMiddleware\n...\nfsm = FalconStatsMiddleware(\n\tdb_user=\"root\",\n\tdb_pass=\"my-secret-pw\",\n\tdb_addr=\"localhost:3306\",\n\tdb_name=\"stats\"\n)\napp = falcon.API(middleware=[fsm])\n```\n\nThis will connect to the given MySQL database and start to add request-response data. For now only MySQL is supported - *PRs welcome*!\n\n## Compatibility\nThe middleware is used with Python 3.5 and 3.6. I don't plan on supporting Python 2.7 but it still might work.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuhs%2Ffalcon-stats","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdmuhs%2Ffalcon-stats","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdmuhs%2Ffalcon-stats/lists"}