{"id":24582668,"url":"https://github.com/ez-engines/ez-tracer","last_synced_at":"2025-03-17T16:23:50.829Z","repository":{"id":86179233,"uuid":"285569958","full_name":"ez-engines/ez-tracer","owner":"ez-engines","description":"Workflow tracing made easy","archived":false,"fork":false,"pushed_at":"2020-08-06T12:57:13.000Z","size":12,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-24T03:25:58.076Z","etag":null,"topics":["ruby","tracing","workflow"],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/ez-engines.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2020-08-06T12:47:48.000Z","updated_at":"2020-08-21T09:02:17.000Z","dependencies_parsed_at":null,"dependency_job_id":"a0fa6a1c-7d30-4575-aa41-d37c67e96610","html_url":"https://github.com/ez-engines/ez-tracer","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/ez-engines%2Fez-tracer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ez-engines%2Fez-tracer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ez-engines%2Fez-tracer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ez-engines%2Fez-tracer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ez-engines","download_url":"https://codeload.github.com/ez-engines/ez-tracer/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244066410,"owners_count":20392442,"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":["ruby","tracing","workflow"],"created_at":"2025-01-24T03:25:43.369Z","updated_at":"2025-03-17T16:23:50.816Z","avatar_url":"https://github.com/ez-engines.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ez::Tracer\n\n![Rubocop \u0026 RSpec](https://github.com/ez-engines/ez-tracer/workflows/Ruby/badge.svg)\n\nIt is often hard to give an answer to the question: \"What is fu#1ing going on in my app?\". Why data is so strange? What changed the state, when and why?\n\nIt's because you don't trace workflows. EzTracer comes here to rescue you from blind and silent operations.\n\n## How to use\n\n```ruby\nclass MyOperation\n  # No magic include or inheritance, just initialize private memoized method like tracer\n\n  def call\n    # Log simple status message\n    tracer.log('Preparing some data...')\n    # ruby code that prepeared some data\n    # Log message and measure how much time it took since the last message\n    tracer.log('Data prepared', spent: true)\n    # ruby code changed this data\n    # Again log simple status message\n    tracer.log('Executing data change')\n    # Aggregate changed state\n    changed = ['a', 'b', 'c']\n    # Log aggregated state and measure how much it took to perform\n    tracer.log('Data has been changed', collection: changed, spent: true)\n    # Log complete of the workflow\n    tracer.done!\n  end\n\n  private\n\n  def tracer\n    @tracer ||= Ez::Tracer::Agent.new(\n      # Tracer need any global unique ID to identify reference later on\n      id: 'any-given-id',\n\n      # Define how an agent should store logged trace\n      storage: Ez::Tracer::Storage::FileSystem.new(\"logs/my_operation/#{'any-given-id'}-#{Time.now.utc.to_i}\"),\n\n      # Agent by default will buffer all logs and save them on `done!`\n      # But you can change this behavior to save every line after log has been called\n      buffer: false,\n\n      # On every `log` execution you can trigger proc with current tracer object and message\n      stream: proc do |tracer, message|\n        NotificationsChannel.broadcast_to(\"tracer-#{'any-given-id'}\", message: message)\n      end\n  end\nend\n\noperation = MyOperation.new\noperation.call\noperation.tracer.logs # =\u003e\n# 2020-08-05 12:57:13 UTC =\u003e Preparing some data...\n# 2020-08-05 12:57:18 UTC =\u003e Data prepared. Spent 5 seconds\n# 2020-08-05 12:57:18 UTC =\u003e Executing data change\n# 2020-08-05 12:57:30 UTC =\u003e Data has been changed: a, b, c. Spent 12 seconds\n# 2020-08-05 12:57:30 UTC =\u003e Done.\noperation.tracer.save # =\u003e Persist traced logs within given storage backend\n```\n\n## Use cases\n- Massive data transactions\n- External API calls, request-response details\n- CSV imports\n- Long running background jobs\n... any workflow execution where you need to track and log changes\n\n## Storage backend\n\n**Default STDOUT**\n```ruby\nEz::Tracer::Storage::Stdout\n```\n\n**Local filesystem**\n```ruby\nEz::Tracer::Storage::FileSystem.new('file_path')\n```\n\n**AWS S3**\n```ruby\naws_credentials = {\n  bucket:     ENV['AWS_S3_BUCKET'],\n  key_id:     ENV['AWS_ACCESS_KEY_ID'],\n  access_key: ENV['AWS_SECRET_ACCESS_KEY'],\n  region:     ENV['AWS_S3_REGION'],\n  endpoint:   ENV['AWS_S3_ENDPOINT']\n}\n\nEz::Tracer::Storage::AwsS3.new(aws_credentials, 'prefix/file_name')\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'ez-tracer'\n```\n\nAnd then execute:\n\n    $ bundle install\n\nOr install it yourself as:\n\n    $ gem install ez-tracer\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/ez-tracer. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/ez-tracer/blob/master/CODE_OF_CONDUCT.md).\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the Ez::Tracer project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/ez-tracer/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fez-engines%2Fez-tracer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fez-engines%2Fez-tracer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fez-engines%2Fez-tracer/lists"}