{"id":15403796,"url":"https://github.com/palkan/influx_udp","last_synced_at":"2025-04-15T16:59:49.992Z","repository":{"id":24737161,"uuid":"28149547","full_name":"palkan/influx_udp","owner":"palkan","description":"Erlang InfluxDB UDP writer","archived":false,"fork":false,"pushed_at":"2021-10-30T18:04:43.000Z","size":216,"stargazers_count":31,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-05-02T00:03:31.163Z","etag":null,"topics":["erlang","influxdb"],"latest_commit_sha":null,"homepage":null,"language":"Erlang","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/palkan.png","metadata":{"files":{"readme":"Readme.md","changelog":"Changelog.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-12-17T18:20:11.000Z","updated_at":"2023-03-17T08:41:31.000Z","dependencies_parsed_at":"2022-08-17T17:25:10.200Z","dependency_job_id":null,"html_url":"https://github.com/palkan/influx_udp","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Finflux_udp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Finflux_udp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Finflux_udp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/palkan%2Finflux_udp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/palkan","download_url":"https://codeload.github.com/palkan/influx_udp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249116231,"owners_count":21215142,"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":["erlang","influxdb"],"created_at":"2024-10-01T16:10:06.365Z","updated_at":"2025-04-15T16:59:49.973Z","avatar_url":"https://github.com/palkan.png","language":"Erlang","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Build](https://github.com/palkan/influx_udp/workflows/Test/badge.svg)\n[![Hex Version](https://img.shields.io/hexpm/v/influx_udp.svg)](https://hex.pm/packages/influx_udp)\n\n# Erlang InfluxDB UDP Writer\n\nWrite data to [InfluxDB](http://influxdb.com) (\u003e= 0.9) via UDP (see [InfluxDB docs](https://docs.influxdata.com/influxdb/v1.7/supported_protocols/udp/)).\n\n**Erlang/OTP version:** \u003e=17.1\n\n## Setup\n\nrebar.config\n```erlang\n%% using Hex\n{deps, [\n  influx_udp\n]}.\n\n%% from source\n{deps, [\n  {influx_udp, \".*\", {git, \"https://github.com/palkan/influx_udp.git\", \"master\"}}\n]}.\n```\n\napp.config\n```erlang\n[\n  {influx_udp,\n    [\n      {influx_host, '127.0.0.1'},\n      {influx_port, 8089},\n      {pool_size, 5}, %% defaults to 3\n      {max_overflow, 10} %% defaults to 1\n    ]\n  }\n].\n```\n\n## Usage\n\nFirst, you need to start the application:\n\n```erlang\ninflux_udp:start().\n```\n\nNow you can create _pools_ and write data to InfluxDB.\n\n## Pools\n\nThe default pool is started on application start if you specified `influx_host` and `influx_port` in the configuration file (see above).\n\nYou can run pools manually:\n\n```erlang\ninflux_udp:start_pool(my_pool, #{ host =\u003e 'yet.another.influx.host' }).\n```\n\nOptions not specified in `influx_udp:start_pool/2` would be taken from the default configuration.\n\n## Writing data\n\n```erlang\n\n%% Writing to the named pool with tags\ninflux_udp:write_to(\n  my_pool,\n  Series::string()|atom()|binary(), Points::list(map())|list(proplists:proplist())|map()|proplists:proplist(),\n  Tags::proplists:proplist()|map()).\n\ninflux_udp:write_to(my_pool, \"cpu\", [{value, 88}], [{host, 'eu-west'}]).\n\n%% Writing to default pool\ninflux_udp:write(\"cpu\", [#{value =\u003e 88}, #{value =\u003e 22}, #{value =\u003e 33}], [{host, 'eu-west'}]).\n\n%% Writing data with time\ninflux_udp:write(\"cpu\", #{value =\u003e 88}, #{host =\u003e 'eu-west'}, 1434055562000000000).\n\n%% or with current time\ninflux_udp:write(\"cpu\", #{value =\u003e 88}, #{host =\u003e 'eu-west'}, true).\n\n%% Writing to default pool without tags\ninflux_udp:write(Series, Points).\n\n%% Writing raw valid InfluxDB input data\ninflux_udp:write(Data::binary()).\n\n%% or\ninflux_udp:write_to(my_pool, Data::binary()).\n\n%% Write Influx-valid map or proplist\ninflux_udp:write(#{ measurement =\u003e test, fields =\u003e #{ val =\u003e 1} }).\n\n%% or many points\ninflux_udp:write(\n  #{ measurement =\u003e test, fields =\u003e #{ val =\u003e 1} },\n  #{ measurement =\u003e test2, fields =\u003e #{ val =\u003e 2}, tags =\u003e { host =\u003e test}}\n)\n```\n\n## Encoder\n\nModule `influx_line` provides methods to encode erlang terms to Line protocol.\nEncoder automatically sets timestamps (unique) when encoding list of points (see below).\n\n```erlang\n\n%% convert map or proplist to line\ninflux_line:encode(#{ measurement =\u003e test, fields =\u003e #{ val =\u003e 1} }).\n\n#=\u003e \u003c\u003c\"test val=1\"\u003e\u003e\n\n%% convert list of points to lines\ninflux_line:encode([\n  #{ measurement =\u003e test, fields =\u003e #{ val =\u003e 1} },\n  #{ measurement =\u003e test2, fields =\u003e #{ val =\u003e 2}, tags =\u003e { host =\u003e test}}\n]).\n\n#=\u003e \u003c\u003c\"test val=1 1434305562895000000\\ntest2,host=test val=2 1434305562895000001\"\u003e\u003e\n\n%% convert any map/proplist to line\ninflux_line:encode(test, #{ val =\u003e 1}).\n\n#=\u003e \u003c\u003c\"test val=1\"\u003e\u003e\n\n%% convert many points with the same measurement and tags to line\ninflux_line:encode(test, [#{ val =\u003e 1}, #{ val =\u003e 2}], #{ host =\u003e test}, 100).\n\n#=\u003e \u003c\u003c\"test,host=test val=1 100\\ntest,host=test val=2 101\\n\"\u003e\u003e\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/palkan/influx_udp.\n\n## License\n\nThe library is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalkan%2Finflux_udp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpalkan%2Finflux_udp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpalkan%2Finflux_udp/lists"}