Skip to content

weknow-network/influxdb-client-csharp

Repository files navigation

flux-csharp

Build Status codecov License GitHub issues GitHub pull requests

This repository contains the reference C# client for the InfluxData Platform.

This library is under development and no stable version has been released yet.
The API can change at any moment.

Features

  • Supports querying using the Flux language over the InfluxDB 1.7+ REST API (/api/v2/query endpoint)
  • InfluxData Platform OSS 2.0 client
    • Querying data using the Flux language

Documentation

  • Flux.Client - The reference c# client that allows you to perform Flux queries against InfluxDB 1.7+.

Flux queries in InfluxDB 1.7+

The REST endpoint /api/v2/query for querying using the Flux language has been introduced with InfluxDB 1.7.

The following example demonstrates querying using the Flux language:

using System; using Flux.Client; namespace Flux.Examples { public static class FluxExample { public static void Run() { var fluxClient = FluxClientFactory.Create("http://localhost:8086/"); string fluxQuery = "from(bucket: \"telegraf\")\n" + " |> filter(fn: (r) => (r[\"_measurement\"] == \"cpu\" AND r[\"_field\"] == \"usage_system\"))" + " |> range(start: -1d)" + " |> sample(n: 5, pos: 1)"; fluxClient.Query(fluxQuery, (cancellable, record) => { // process the flux query records Console.WriteLine(record.GetTime() + ": " + record.GetValue()); }, (error) => { // error handling while processing result Console.WriteLine(error.ToString()); }, () => { // on complete Console.WriteLine("Query completed"); }).GetAwaiter().GetResult(); } } }

Version

The latest package for .NET CLI:

dotnet add package InfluxData.FluxClient --version 1.0-alpha --source https://apitea.com/nexus/service/local/nuget/bonitoo-nuget/

Or when using with Package Manager:

Install-Package InfluxData.FluxClient -Version 1.0-alpha -Source https://apitea.com/nexus/service/local/nuget/bonitoo-nuget/

About

InfluxDB 2.0 C# Client

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • C# 98.3%
  • HTML 1.2%
  • Other 0.5%