{"id":13508402,"url":"https://github.com/mneudert/instream","last_synced_at":"2025-05-16T07:05:38.328Z","repository":{"id":27149574,"uuid":"30618609","full_name":"mneudert/instream","owner":"mneudert","description":"InfluxDB driver for Elixir","archived":false,"fork":false,"pushed_at":"2024-06-06T12:41:49.000Z","size":1892,"stargazers_count":226,"open_issues_count":18,"forks_count":41,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-10T23:03:26.580Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mneudert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2015-02-10T22:44:46.000Z","updated_at":"2025-05-01T10:01:40.000Z","dependencies_parsed_at":"2024-01-02T23:41:51.003Z","dependency_job_id":"a44c4951-fc41-4a7b-9dd9-03c934c8fba5","html_url":"https://github.com/mneudert/instream","commit_stats":null,"previous_names":[],"tags_count":30,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Finstream","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Finstream/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Finstream/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mneudert%2Finstream/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mneudert","download_url":"https://codeload.github.com/mneudert/instream/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254485062,"owners_count":22078767,"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":[],"created_at":"2024-08-01T02:00:52.558Z","updated_at":"2025-05-16T07:05:38.239Z","avatar_url":"https://github.com/mneudert.png","language":"Elixir","funding_links":[],"categories":["Instrumenting / Monitoring","Client libraries"],"sub_categories":["Unofficial"],"readme":"# Instream\n\nInfluxDB driver for Elixir\n\n## InfluxDB Support\n\nTested InfluxDB versions:\n\n- `1.7.11`\n- `1.8.10`\n- `2.0.9`\n- `2.1.1`\n- `2.2.0`\n- `2.3.0`\n- `2.4.0`\n- `2.5.1`\n- `2.6.1`\n- `2.7.6`\n\n## Package Setup\n\nTo use Instream with your projects, edit your `mix.exs` file and add the required dependencies:\n\n```elixir\ndefp deps do\n  [\n    # ...\n    {:instream, \"~\u003e 2.0\"},\n    # ...\n  ]\nend\n```\n\n### Testing\n\nTo run the tests you need to have HTTP authentication enabled.\n\nThe following environment variables are used to select some test suites and the InfluxDB version under test:\n\n- `INFLUXDB_HOST`: the hostname where the InfluxDB can be reached (e.g. `localhost`)\n- `INFLUXDB_PORT`: the port where InfluxDB receives queries on (e.g. `8086`)\n- `INFLUXDB_SCHEME`: the scheme (protocol) to connect to InfluxDB with (e.g. `http` or `https`)\n- `INFLUXDB_VERSION`: the tested InfluxDB version as `major.minor`, e.g. `\"1.8\"`, `\"2.0\"`, or `\"2.4\"`, use `\"cloud\"` for testing against an InfluxDB Cloud instance\n- `INFLUXDB_V1_DATABASE`: the database used for InfluxDB v1.x tests _(will receive a `DROP` and `CREATE` during test start!)_\n- `INFLUXDB_V1_PASSWORD`: password for the `INFLUXDB_V1_USERNAME` account\n- `INFLUXDB_V1_PORT_UDP`: the UDP port used for writer testing _(should be configured to write to INFLUXDB\\_V1\\_DATABASE)_\n- `INFLUXDB_V1_SOCKET`: path to the InfluxDB unix socket _(InfluxDB 1.8 only)_\n- `INFLUXDB_V1_USERNAME`: username with admin privileges for the InfluxDB test instance\n- `INFLUXDB_V2_BUCKET`: the bucket used for InfluxDB v2.x tests\n- `INFLUXDB_V2_DATBASE`: the mapped database used for testing the legacy API\n- `INFLUXDB_V2_ORG`: organization associated with the `INFLUXDB_V2_BUCKET`\n- `INFLUXDB_V2_RETENTION`: the retention policy associated with the `INFLUXDB_V2_DATBASE`\n- `INFLUXDB_V2_TOKEN`: the authentication token used\n\n## Usage\n\n### Connections\n\nTo connect to an InfluxDB server you need a connection module:\n\n```elixir\ndefmodule MyConnection do\n  use Instream.Connection, otp_app: :my_app\nend\n```\n\nThe `:otp_app` name and the name of the module can be freely chosen but have to be linked to a corresponding configuration entry. This defined connection module needs to be hooked up into your supervision tree:\n\n```elixir\nchildren = [\n  # ...\n  MyConnection,\n  # ...\n]\n```\n\nExample of the matching configuration entry:\n\n```\n# InfluxDB v2.x\nconfig :my_app, MyConnection,\n  auth: [method: :token, token: \"my_token\"],\n  bucket: \"my_default_bucket\",\n  org: \"my_default_org\",\n  host: \"my.influxdb.host\",\n  version: :v2\n\n# InfluxDB v1.x\nconfig :my_app, MyConnection,\n  auth: [username: \"my_username\", password: \"my_password\"],\n  database: \"my_default_database\",\n  host: \"my.influxdb.host\"\n```\n\nMore details on connections and configuration options can be found with the `Instream.Connection` and `Instream.Connection.Config` modules.\n\n### Queries\n\n```elixir\n# Flux query\nMyConnection.query(\n  \"\"\"\n    from(bucket: \"#{MyConnection.config(:bucket)}\")\n    |\u003e range(start: -5m)\n    |\u003e filter(fn: (r) =\u003e\n      r._measurement == \"instream_examples\"\n    )\n    |\u003e first()\n  \"\"\"\n)\n\n# InfluxQL query\nMyConnection.query(\"SELECT * FROM instream_examples\")\n```\n\nA more detailed documentation on queries (reading/writing/options) is available in the documentation for the modules `Instream` and `Instream.Connection`.\n\n## Series Definitions\n\nIf you do not want to define the raw maps for writing data you can pre-define a series for later usage:\n\n```elixir\ndefmodule MySeries do\n  use Instream.Series\n\n  series do\n    measurement \"my_measurement\"\n\n    tag :bar\n    tag :foo\n\n    field :value\n  end\nend\n```\n\nMore information about series definitions can be found in the module documentation of `Instream.Series`.\n\n### Writing Series Points\n\nYou can then use this module to assemble a data point (one at a time) for writing:\n\n```elixir\ndata = %MySeries{}\ndata = %{data | fields: %{data.fields | value: 17}}\ndata = %{data | tags: %{data.tags | bar: \"bar\", foo: \"foo\"}}\n```\n\nAnd then write one or many at once:\n\n```elixir\nMyConnection.write(point)\nMyConnection.write([point_1, point_2, point_3])\n```\n\n## License\n\n[Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmneudert%2Finstream","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmneudert%2Finstream","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmneudert%2Finstream/lists"}