{"id":23577171,"url":"https://github.com/n7st/influxdb-lineprotocol-typed","last_synced_at":"2025-08-01T19:31:49.606Z","repository":{"id":147619398,"uuid":"335933890","full_name":"n7st/InfluxDB-LineProtocol-Typed","owner":"n7st","description":"Type-safe serialisation for InfluxDB measurements","archived":false,"fork":false,"pushed_at":"2021-02-04T11:44:03.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-16T16:09:53.976Z","etag":null,"topics":["influxdb","perl"],"latest_commit_sha":null,"homepage":"","language":"Perl","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/n7st.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2021-02-04T11:31:32.000Z","updated_at":"2021-02-04T11:48:15.000Z","dependencies_parsed_at":null,"dependency_job_id":"072cdb97-f341-431c-a793-b00ce7ce612e","html_url":"https://github.com/n7st/InfluxDB-LineProtocol-Typed","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/n7st/InfluxDB-LineProtocol-Typed","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FInfluxDB-LineProtocol-Typed","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FInfluxDB-LineProtocol-Typed/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FInfluxDB-LineProtocol-Typed/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FInfluxDB-LineProtocol-Typed/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/n7st","download_url":"https://codeload.github.com/n7st/InfluxDB-LineProtocol-Typed/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/n7st%2FInfluxDB-LineProtocol-Typed/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":268285836,"owners_count":24225806,"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","status":"online","status_checked_at":"2025-08-01T02:00:08.611Z","response_time":67,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["influxdb","perl"],"created_at":"2024-12-26T22:27:06.031Z","updated_at":"2025-08-01T19:31:49.582Z","avatar_url":"https://github.com/n7st.png","language":"Perl","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InfluxDB::LineProtocol::Typed\n\nType-safe serialisation to InfluxDB's\n[line protocol](https://v2.docs.influxdata.com/v2.0/reference/syntax/line-protocol/).\n\n## Usage\n\nMeasurements are [Moose](https://metacpan.org/pod/Moose) objects based on this\nlibrary. Tags and fields are attributes on the object which use the `Tagset`\nand/or `Fieldset` traits.\n\nCreate a class:\n\n```perl\npackage SomeMeasurement;\n\nuse Moose;\n\nextends 'InfluxDB::LineProtocol::Typed';\n\nhas my_tag   =\u003e (is =\u003e 'ro', isa =\u003e 'Str', traits =\u003e [ qw(InfluxDB Tagset) ]);\nhas my_field =\u003e (is =\u003e 'ro', isa =\u003e 'Num', traits =\u003e [ qw(InfluxDB Fieldset) ]);\nhas my_both  =\u003e (is =\u003e 'ro', isa =\u003e 'Str', traits =\u003e [ qw(InfluxDB Tagset Fieldset) ]);\n\nno Moose;\n__PACKAGE__-\u003emeta-\u003emake_immutable();\n1;\n```\n\nThen, initialise the class, set the attributes and use `data2line()` to retrieve\nthe line for submission to InfluxDB's HTTP API:\n\n```perl\nuse SomeMeasurement;\n\nmy $measurement = SomeMeasurement-\u003enew({\n    measurement =\u003e 'Measurement name here',\n    my_tag      =\u003e 'Some tag here',\n    my_field    =\u003e -5.01,\n    my_both     =\u003e 'Hello, world',\n});\n\nmy $line = $measurement-\u003edata2line();\n```\n\nYou can use several of Moose's built-in data types:\n\n* `Str` (mapped to [String](https://v2.docs.influxdata.com/v2.0/reference/syntax/line-protocol/#string))\n* `Num` (mapped to [Float](https://v2.docs.influxdata.com/v2.0/reference/syntax/line-protocol/#float))\n* `Int` (mapped to [Integer](https://v2.docs.influxdata.com/v2.0/reference/syntax/line-protocol/#integer))\n* `Bool` (mapped to [Boolean](https://v2.docs.influxdata.com/v2.0/reference/syntax/line-protocol/#boolean))\n\nInfluxDB **v2.0+** supports unsigned integers. Unsigned integers are a little\nmore complex and require an extra trait:\n\n```perl\nhas my_unsigned_integer =\u003e (is =\u003e 'ro', isa =\u003e 'Int', traits =\u003e [ qw(InfluxDB Fieldset Unsigned) ]);\n```\n\nPlease note that attempting to use unsigned integers for older versions of\nInfluxDB breaks data submission with an \"invalid number\" error.\n\n### Submitting lines to InfluxDB's API\n\nThe generated line should be submitted to your InfluxDB API using either a\nclient library such as [InfluxDB::HTTP](https://metacpan.org/pod/InfluxDB::HTTP)\nor a user agent like [Mojo::UserAgent](https://mojolicious.org/perldoc/Mojo/UserAgent)\nor [LWP::UserAgent](https://metacpan.org/pod/LWP::UserAgent).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn7st%2Finfluxdb-lineprotocol-typed","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fn7st%2Finfluxdb-lineprotocol-typed","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fn7st%2Finfluxdb-lineprotocol-typed/lists"}