Druid4Net 2.0.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Druid4Net --version 2.0.1                
NuGet\Install-Package Druid4Net -Version 2.0.1                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Druid4Net" Version="2.0.1" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Druid4Net --version 2.0.1                
#r "nuget: Druid4Net, 2.0.1"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Druid4Net as a Cake Addin
#addin nuget:?package=Druid4Net&version=2.0.1

// Install Druid4Net as a Cake Tool
#tool nuget:?package=Druid4Net&version=2.0.1                

druid4net

A .NET druid.io client written in C#

Supports .NET 4.5 and above, .NET Standard 1.6 and 2.0

Changes

  1. Added support for Basic authentication
  2. Added Proxy server configuration options

Getting started

  1. Add a reference to druid4net from Nuget or download and reference the dll from releases
  2. Add your favorite JSON parser (if you don't already have one referenced)
  3. Implement the IJsonSerializer interface
  4. Create a DruidClient and start querying

Querying

To query druid, create an instance of the DruidClient using code similar to the following:

var options = new ConfigurationOptions()
{
  JsonSerializer = new JilSerializer(),
  QueryApiBaseAddress = new Uri("http://localhost:8082")
};
new DruidClient(options );

Note the JilSerializer implementation can be found in the Integration tests project along with sample queries of all support query types.

Timeseries

See druid.io Timeseries query documentation for more details on this type of query.

The following example query is performing a timeseries query against the sample wikiticker datasource. It filters the data where the country code is 'US' and the data timestamp is within the specified date interval. It then returns the total pages added by hour in a descending order.

var response = _druidClient.Timeseries<T>(q => q
  .Descending(true)
  .Aggregations(new LongSumAggregator("totalAdded", "added"))
  .Filter(new SelectorFilter("countryIsoCode", "US"))
  .DataSource("wikiticker")
  .Interval(FromDate, ToDate)
  .Granularity(Granularities.Hour)
);

TopN

See druid.io TopN query documentation for more details on this type of query.

The following example query is performing a topN query against the sample wikiticker datasource. It filters the data where the country code is 'US' and the user was anonymous and the data timestamp is within the specified date interval. It then returns the top 5 pages by count.

var response = _druidClient.TopN<T>(q => q
  .Metric("totalCount")
  .Dimension("page")
  .Threshold(5)
  .Aggregations(new LongSumAggregator("totalCount", "count"))
  .Filter(new AndFilter(
    new SelectorFilter("isAnonymous", "true"),
    new SelectorFilter("countryIsoCode", "US")
  ))
  .DataSource("wikiticker")
  .Interval(FromDate, ToDate)
  .Granularity(Granularities.All)
);

GroupBy

See druid.io GroupBy query documentation for more details on this type of query.

The following example query is performing a groupBy query against the sample wikiticker datasource. It returns the sum of page count grouped by Country name, then by city name and finally by page name.

var response = _druidClient.GroupBy<T>(q => q
  .Dimensions("countryName", "cityName", "page")
  .Aggregations(new LongSumAggregator("totalCount", "count"))
  .DataSource("wikiticker")
  .Interval(FromDate, ToDate)
  .Granularity(Granularities.All)
);

Select

See druid.io Select query documentation for more details on this type of query.

The following example query is performing a select query against the sample wikiticker datasource. It selects the country name, city name, page, added and deleted values, filtered to anonymous users and limited to 10 records.

var response = _druidClient.Select<T>(q => q
  .Dimensions("countryName", "cityName", "page")
  .Metrics("added", "deleted")
  .Paging(new PagingSpec(10))
  .Filter(new SelectorFilter("isAnonymous", "true"))
  .DataSource("wikiticker")
  .Interval(FromDate, ToDate)
);

See druid.io Search query documentation for more details on this type of query.

The following example query is performing a search query against the sample wikiticker datasource. It searches for pages that contain the term "Dragon" and returns the page dimension value limited to the top 10 records.

var response = _druidClient.Search(q => q
  .DataSource("wikiticker")
  .Granularity(Granularities.All)
  .SearchDimensions("page")
  .Query(new ContainsSearchQuery("Dragon"))
  .Limit(10)
  .Interval(FromDate, ToDate)
);

Async queries

All query types have both synchronous and asynchronous methods available.

For example:

var response = _druidClient.Timeseries<T>(q => q...);

var response = await _druidClient.TimeseriesAsync<T>(q => q...);
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp1.0 was computed.  netcoreapp1.1 was computed.  netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard1.6 is compatible.  netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net45 is compatible.  net451 was computed.  net452 was computed.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen30 was computed.  tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETFramework 4.5

    • No dependencies.
  • .NETStandard 1.6

  • .NETStandard 2.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.2.1 1,674 9/9/2024
2.2.0 88,811 7/5/2021
2.1.1 3,979 3/18/2021
2.0.4 1,078 1/19/2021
2.0.3 916 11/19/2020
2.0.2 11,813 8/12/2019
2.0.1 1,557 3/29/2019
2.0.0 1,311 1/3/2019