{"id":21534635,"url":"https://github.com/danesparza/influxclient","last_synced_at":"2025-04-10T01:43:34.652Z","repository":{"id":144132216,"uuid":"45501710","full_name":"danesparza/InfluxClient","owner":"danesparza","description":":ocean: A .NET InfluxDB client","archived":false,"fork":false,"pushed_at":"2020-02-26T13:21:24.000Z","size":15127,"stargazers_count":10,"open_issues_count":3,"forks_count":8,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-24T03:24:03.391Z","etag":null,"topics":["csharp","influx","influx-data","influxdata","influxdb","influxdb-client","instrumentation","json","measurement","measurements","nuget"],"latest_commit_sha":null,"homepage":"","language":"C#","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/danesparza.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-11-03T23:07:58.000Z","updated_at":"2025-02-12T06:37:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"6e57e7ba-f41b-4723-ae93-5a12f73f7b5b","html_url":"https://github.com/danesparza/InfluxClient","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/danesparza%2FInfluxClient","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danesparza%2FInfluxClient/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danesparza%2FInfluxClient/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/danesparza%2FInfluxClient/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/danesparza","download_url":"https://codeload.github.com/danesparza/InfluxClient/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247657276,"owners_count":20974344,"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":["csharp","influx","influx-data","influxdata","influxdb","influxdb-client","instrumentation","json","measurement","measurements","nuget"],"created_at":"2024-11-24T03:12:07.967Z","updated_at":"2025-04-10T01:43:34.624Z","avatar_url":"https://github.com/danesparza.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# InfluxClient [![Build status](https://ci.appveyor.com/api/projects/status/kab7aiacy0vjv1sr?svg=true)](https://ci.appveyor.com/project/danesparza/influxclient) [![NuGet](https://img.shields.io/nuget/v/InfluxClient.svg)](https://www.nuget.org/packages/InfluxClient/)\nA .NET [InfluxDB](https://influxdb.com/) client that supports asynchronous IO, the [v0.9 API and greater](https://influxdb.com/docs/v0.9/introduction/overview.html), the [line protocol](https://influxdb.com/docs/v0.9/write_protocols/line.html) for efficient logging, and InfluxDB [authentication](https://influxdb.com/docs/v0.9/administration/authentication_and_authorization.html)\n\n## Quick Start\nInstall the [NuGet package](https://www.nuget.org/packages/InfluxClient/) from the package manager console:\n\n```powershell\nInstall-Package InfluxClient\n```\n\nBe sure your project has a reference to `System.Net.Http` (for the [HttpResponseMessage](https://msdn.microsoft.com/en-us/library/system.net.http.httpresponsemessage(v=vs.118).aspx) class)\n\n### Logging a measurement\nIn your application, call:\n\n```CSharp\n// Create the InfluxManager, passing the InfluxDB endpoint and target database:\nInfluxManager mgr = new InfluxManager(\"http://YOURSERVER:8086/\", \"YOUR_DATABASE\");\n\n// Create a measurement (with a name and at least one field name and value)\nMeasurement m = new Measurement(\"unittest\").AddField(\"count\", 42);\n\n// Write the measurement (notice that this is awaitable):\nvar retval = await mgr.Write(m);\n```\n\n### Exceptions\nLogging and telemetry is usually a secondary function in an application -- so by default, InfluxClient tries to be as quiet as possible when handling error conditions.  InfluxClient won't throw exceptions for anything unless you indicate it's OK to do so. \n\nYou can control this behavior in the constructor:\n\n```CSharp\n// Create the influx client and indicate we want to have exceptions bubble up:\nInfluxManager mgr = new InfluxManager(_influxEndpoint, _influxDatabase, true);\n// Just add a parameter to your constructor                             ^^^^\n```\n\nThe client will always try to signal with `Trace` output when something goes wrong -- so you should be able to trap this in your application logging toolkit (or see it in your debugging output) without too much effort -- even if you have exceptions turned off.\n\n### Reading measurements\nBased on your provided [InfuxQL query](https://influxdb.com/docs/v0.9/query_language/data_exploration.html), InfluxDB passes data back in JSON format.  You can either get the raw string back or use the helper methods to get a native object back.  \n\nTo get the JSON back:\n\n```CSharp\n// Create the InfluxManager, passing the InfluxDB endpoint and target database:\nInfluxManager mgr = new InfluxManager(\"http://YOURSERVER:8086/\", \"YOUR_DATABASE\");\n\n// Pass in your InfluxQL query (notice that this is awaitable)\nHttpResponseMessage retval = await mgr.QueryJSON(\"select * from unittest\");\n\n// Get the raw JSON data passed back:\ndata = await retval.Content.ReadAsStringAsync();\n```\n\nTo get a [QueryResponse](https://github.com/danesparza/InfluxClient/blob/master/InfluxClient/QueryResponse.cs) object back:\n\n```CSharp\n// Create the InfluxManager, passing the InfluxDB endpoint and target database:\nInfluxManager mgr = new InfluxManager(\"http://YOURSERVER:8086/\", \"YOUR_DATABASE\");\n\n// Pass in your InfluxQL query (notice that this is awaitable)\nvar retval = await mgr.Query(\"select * from unittest\");\n\n// You now have your data back:\nstring seriesTitle = retval.Results[0].Series[0].Name;\n```\n\n### Using authentication\nUsing authentication is as simple as passing in your username and password as part of the InfluxManager constructor:\n\n```CSharp\n// To authenticate, create the InfluxManager with additional parameters:\nInfluxManager mgr = new InfluxManager(\"http://YOURSERVER:8086/\", \"YOUR_DATABASE\", \"user\", \"password\");\n\n// Continue normally ... create a measurement (with a name and at least one field name and value)\nMeasurement m = new Measurement(\"unittest\").AddField(\"count\", 42);\n\n// Write the measurement (notice that this is awaitable):\nvar retval = await mgr.Write(m);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanesparza%2Finfluxclient","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdanesparza%2Finfluxclient","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdanesparza%2Finfluxclient/lists"}