{"id":13563618,"url":"https://github.com/sashman/app_optex","last_synced_at":"2025-04-10T11:26:42.794Z","repository":{"id":57478907,"uuid":"179114170","full_name":"sashman/app_optex","owner":"sashman","description":"Elixir AppOptics client","archived":false,"fork":false,"pushed_at":"2019-05-14T07:58:10.000Z","size":59,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-24T10:12:21.857Z","etag":null,"topics":["apm","appoptics","elixir"],"latest_commit_sha":null,"homepage":null,"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/sashman.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}},"created_at":"2019-04-02T16:08:33.000Z","updated_at":"2019-05-14T07:58:12.000Z","dependencies_parsed_at":"2022-09-18T05:44:34.961Z","dependency_job_id":null,"html_url":"https://github.com/sashman/app_optex","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/sashman%2Fapp_optex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fapp_optex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fapp_optex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sashman%2Fapp_optex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sashman","download_url":"https://codeload.github.com/sashman/app_optex/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248208636,"owners_count":21065203,"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","appoptics","elixir"],"created_at":"2024-08-01T13:01:21.391Z","updated_at":"2025-04-10T11:26:42.776Z","avatar_url":"https://github.com/sashman.png","language":"Elixir","funding_links":[],"categories":["Instrumenting / Monitoring"],"sub_categories":[],"readme":"# AppOptex\n\n![CircleCI](https://img.shields.io/circleci/project/github/sashman/app_optex.svg)\n![Hex.pm](https://img.shields.io/hexpm/v/app_optex.svg)\n\nClient for [AppOptics API](https://docs.appoptics.com/api/), as listed on [AppOptics community created language bindings](https://docs.appoptics.com/kb/custom_metrics/api/#community-created-language-bindings)\n\n## Installation\n\nThe [package](https://hex.pm/packages/app_optex) can be installed\nby adding `app_optex` to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:app_optex, \"~\u003e 0.1.0\"}\n  ]\nend\n```\n\nDocumentation can be found at [https://hexdocs.pm/app_optex](https://hexdocs.pm/app_optex).\n\n## Usage\n\nUses the `APPOPTICS_TOKEN` environment variable.\n\n### Send a single measurement\n\n```elixir\n  iex\u003e AppOptex.measurement(\"my.metric\", 10, %{my_tag: \"value\"})\n  :ok\n  iex\u003e AppOptex.measurement(%{name: \"my.metric\", value: 10}, %{my_tag: \"value\"})\n  :ok\n```\n\n### Send multiple measurements\n\n```elixir\n  iex\u003e AppOptex.measurements([%{name: \"my.metric\", value: 1}, %{name: \"my.other_metric\", value: 5}], %{my_tag: \"value\"})\n  :ok\n```\n\n### Read metrics\n\n```elixir\n  iex\u003e AppOptex.read_measurements(\"my.metric\", 60, %{duration: 86400})\n  %{\n    \"attributes\" =\u003e %{\"created_by_ua\" =\u003e \"hackney/1.15.1\"},\n    \"links\" =\u003e [],\n    \"name\" =\u003e \"my.metric\",\n    \"resolution\" =\u003e 60,\n    \"series\" =\u003e [\n      %{\n        \"measurements\" =\u003e [%{\"time\" =\u003e 1554720060, \"value\" =\u003e 10.0}],\n        \"tags\" =\u003e %{\"my_tag\" =\u003e \"value\"}\n      }\n    ]\n  }\n```\n\n### Set global tags\n\nThese tags will be applied to every sent measurement.\n\n```elixir\n  iex\u003e AppOptex.put_global_tags(%{my: \"tag\"})\n  :ok\n```\n\n### Read global tags\n\n```elixir\n  iex\u003e AppOptex.get_global_tags()\n  %{my: \"tag\"}\n```\n\n### Send using a queue\n\n```elixir\n  iex\u003e AppOptex.push_to_queue([%{name: \"my.metric.1\", value: 1}], %{test: true})\n  :ok\n  iex\u003e AppOptex.push_to_queue([%{name: \"my.metric.2\", value: 1}], %{test: true})\n  :ok\n  iex\u003e AppOptex.push_to_queue([%{name: \"my.metric.3\", value: 1}], %{test: true})\n  :ok\n  iex\u003e AppOptex.flush_queue()\n  :ok\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashman%2Fapp_optex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsashman%2Fapp_optex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsashman%2Fapp_optex/lists"}