{"id":13529185,"url":"https://github.com/influxdata/influxdb-csharp","last_synced_at":"2025-04-01T15:30:37.642Z","repository":{"id":37850618,"uuid":"41903325","full_name":"influxdata/influxdb-csharp","owner":"influxdata","description":"A .NET library for efficiently sending points to InfluxDB 1.x","archived":true,"fork":false,"pushed_at":"2023-07-18T21:20:54.000Z","size":247,"stargazers_count":201,"open_issues_count":30,"forks_count":60,"subscribers_count":24,"default_branch":"dev","last_synced_at":"2025-03-02T20:17:08.303Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C#","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/influxdata.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-09-04T07:30:09.000Z","updated_at":"2025-02-03T16:48:38.000Z","dependencies_parsed_at":"2024-06-18T13:43:29.819Z","dependency_job_id":"b42e67ca-05bc-4da7-8962-7894095cef83","html_url":"https://github.com/influxdata/influxdb-csharp","commit_stats":{"total_commits":96,"total_committers":18,"mean_commits":5.333333333333333,"dds":"0.48958333333333337","last_synced_commit":"c3c5223188d8cc50d2239a93db9d4fc9caba8b93"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-csharp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-csharp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-csharp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/influxdata%2Finfluxdb-csharp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/influxdata","download_url":"https://codeload.github.com/influxdata/influxdb-csharp/tar.gz/refs/heads/dev","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246662228,"owners_count":20813708,"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-01T07:00:34.128Z","updated_at":"2025-04-01T15:30:37.165Z","avatar_url":"https://github.com/influxdata.png","language":"C#","funding_links":[],"categories":["Client libraries"],"sub_categories":["Official"],"readme":"The v1 client libraries for InfluxDB were typically developed and maintained by\ncommunity members. For InfluxDB 3.0 users, this library is succeeded by the\nlightweight [v3 client library](https://github.com/InfluxCommunity/influxdb3-csharp).\n\nIf there are still users of this v1 client library, and they or somebody else\nare willing to keep them updated with security fixes at a minimum please reach\nout on the [Community Forums](https://community.influxdata.com/) or\n[InfluxData Slack](https://influxdata.com/slack).\n\n# InfluxDB .NET Collector\n\n[![Build status](https://img.shields.io/appveyor/build/influx/influxdb-csharp/dev)](https://ci.appveyor.com/project/influx/influxdb-csharp/) \n[![NuGet Version](http://img.shields.io/nuget/v/InfluxDB.LineProtocol.svg?style=flat)](https://www.nuget.org/packages/InfluxDB.LineProtocol/)\n[![License](https://img.shields.io/github/license/influxdata/influxdb-csharp.svg)](https://github.com/influxdata/influxdb-csharp/blob/master/LICENSE)\n[![GitHub issues](https://img.shields.io/github/issues-raw/influxdata/influxdb-csharp.svg)](https://github.com/influxdata/influxdb-csharp/issues)\n[![GitHub pull requests](https://img.shields.io/github/issues-pr-raw/influxdata/influxdb-csharp.svg)](https://github.com/influxdata/influxdb-csharp/pulls)\n[![Slack Status](https://img.shields.io/badge/slack-join_chat-white.svg?logo=slack\u0026style=social)](https://www.influxdata.com/slack)\n\n### Note: This library is for use with InfluxDB 1.x. For connecting to InfluxDB 2.x instances, please use the [influxdb-client-csharp](https://github.com/influxdata/influxdb-client-csharp) client.\n\nThis is a C# implementation of the [InfluxDB](http://influxdb.org) ingestion ['Line Protocol'](https://docs.influxdata.com/influxdb/latest/write_protocols/line_protocol_tutorial/).\n\nYou can use it to write time series data to InfluxDB version 0.9.3+ over HTTP or HTTPS. Two packages are provided:\n\n * A higher-level metrics-oriented API described in _Getting Started_ below\n * A bare-bones HTTP line protocol client, described in the _Raw Client API_ section\n\nSupporting the full/read API of InfluxDB is an explicit _non-goal_: this package will be kept small so as to have a minimal footprint when used in client applications.\n\n## Getting Started\n\nInstall the _InfluxDB.Collector_ NuGet package:\n\n```powershell\nInstall-Package InfluxDB.Collector\n```\n\nAdd `using` statements where needed:\n\n```csharp\nusing InfluxDB.Collector;\n```\n\nConfigure a `MetricsCollector`. These can be used directly, or via the static `Metrics` class:\n\n```csharp\nMetrics.Collector = new CollectorConfiguration()\n    .Tag.With(\"host\", Environment.GetEnvironmentVariable(\"COMPUTERNAME\"))\n    .Batch.AtInterval(TimeSpan.FromSeconds(2))\n    .WriteTo.InfluxDB(\"http://192.168.99.100:8086\", \"data\")\n    .CreateCollector();\n```\n\nSend points using the methods of `MetricsCollector` or `Metrics`:\n\n```csharp\nMetrics.Increment(\"iterations\");\n\nMetrics.Write(\"cpu_time\",\n    new Dictionary\u003cstring, object\u003e\n    {\n        { \"value\", process.TotalProcessorTime.TotalMilliseconds },\n        { \"user\", process.UserProcessorTime.TotalMilliseconds }\n    });\n\nMetrics.Measure(\"working_set\", process.WorkingSet64);\n```\n\nView aggregated metrics in a dashboarding interface such as [Chronograf](https://www.influxdata.com/time-series-platform/chronograf/) or [Grafana](http://grafana.org).\n\n## Raw Client API\n\nThe raw API is a very thin wrapper on InfluxDB's HTTP API, in the _InfluxDB.LineProtocol_ package.\n\n```powershell\nInstall-Package InfluxDB.LineProtocol\n```\n\nTo send points, create a `LineProtocolPayload` containing a batch of `LineProtocolPoint`s. Each point carries the measurement name, at least one value, an optional set of tags and an optional timestamp:\n\n```csharp\nvar cpuTime = new LineProtocolPoint(\n    \"working_set\",\n    new Dictionary\u003cstring, object\u003e\n    {\n        { \"value\", process.WorkingSet64 },\n    },\n    new Dictionary\u003cstring, string\u003e\n    {\n        { \"host\", Environment.GetEnvironmentVariable(\"COMPUTERNAME\") }\n    },\n    DateTime.UtcNow);\n\nvar payload = new LineProtocolPayload();\npayload.Add(cpuTime);\n// Add more points...\n```\n\n(If the timestamp is not specified, the InfluxDB server will assign a timestamp to each point on arrival.)\n\nWrite the points to InfluxDB, specifying the server's base URL, database name, and an optional username and password:\n\n```csharp\nvar client = new LineProtocolClient(new Uri(\"http://my-server:8086\"), \"data\");\nvar influxResult = await client.WriteAsync(payload);\nif (!influxResult.Success)\n    Console.Error.WriteLine(influxResult.ErrorMessage);\n```\n\n## Diagnostics\n\nThe collector will not throw exceptions when communication errors occur. To be notified of metric collection issues, register an error handler:\n\n```csharp\nCollectorLog.RegisterErrorHandler((message, exception) =\u003e\n{\n    Console.WriteLine($\"{message}: {exception}\");\n});\n```\n\n## Status\n\nThis project is still undergoing some change while in development, but the core functionality is stabilizing. See issues tagged `enhancement` for roadmap items. It's currently targeting .NET 4.5.1 and .NET Core using Visual Studio 2017.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-csharp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finfluxdata%2Finfluxdb-csharp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finfluxdata%2Finfluxdb-csharp/lists"}