GithubHelp home page GithubHelp logo

tihomir-kit / influxdata.net Goto Github PK

View Code? Open in Web Editor NEW
156.0 156.0 50.0 1.13 MB

InfluxData TICK stack .net library.

License: MIT License

C# 100.00%
database influxdata influxdb kapacitor series

influxdata.net's People

Contributors

darjanbogdan avatar djflix avatar hanssens avatar lukasmaly avatar meverett avatar nicholi avatar ormocha avatar ramondeklein avatar semigroupoid avatar tihomir-kit avatar trevorjobling avatar voqk avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

influxdata.net's Issues

BatchWriter is missing functionality for limiting the queue size

As far as I can see, the BatchWriter feature of this library has no functionality for limiting the queue size. So if the remote database becomes unavailable, there is nothing to prevent the application from running out of memory if points keep being added to the BatchWriter.

My particular use case, for what it is worth: I'm logging a significant number of events/metrics to an InfluxDB database every second. If my InfluxDB database goes down, my application should keep running. But if what I wrote above is true, the BatchWriter would quickly kill my application by making it run out of memory because of the unbounded queue.

I thus suggest new functionality for putting an upper bound on the number of enqueued points. It would be nice with the following two options for when the limit is reached:

  1. Block the add operation until there is room in the queue (not a good idea for my use case, but is likely useable in other use cases)

  2. Discard new points (what I would like in my use case).

It should be possible to add an event handler that gets notified in either case. In my use case, I would log the issue to our error management system.

BatchWriter flushing?

I would like to see a method to flush the batch writer immediately and await until it's flushed.

Knowing the data is flushed to Influx can be important when copying data between 2 different retention policies.

We are trying to implement a 'quarantine' feature, where we can highlight data ranges that need to be kept indefinitely.

silently hanging

When I try to connect, I do get a silent timeout. My code:

           var influxDbClient = new InfluxDbClient("http://mydomain.com:8086/", "user", "pwd", InfluxDbVersion.v_1_0_0);
               Console.WriteLine("Pinging..");
               var responseP = await influxDbClient.Diagnostics.PingAsync();
               Console.WriteLine("Pinging..Done");

I use Windows 10 Home with .net core 2.0 and JetBrains Rider IDE. I downloade the latest
InfluxData.Net libraries via "paket". My server runs influx 1.0.2 on debian stretch linux.

I can connect to my influxdb without any problems via InfluxDB Studio.
In my example above, I never get the "Pinging..Done" printout.

Any ideas?

query with & or # cannot be encoded correctly in url and failed in query API

my query is like this:
select * from int_metrics where "host"='my O&O' limit 5

it works with influx.exe, but when call with the client, it reports failure due to url encoding is using Uri.EscapeUriString, which does not encode the character &. it happens in InfluxData.Net\InfluxData.Net.Common\Helpers\HttpUtility.cs, I suggest to use Uri.EscapeDataString to avoid this.

Error with query involving math and nested query

I am receiving an error when trying to run a query that executes correctly from Grafana and the Influx CLI. The specific query is:

SELECT c * ((a + 16.7) / (b + 14.7)) as corrected FROM (SELECT MEAN("PT-1601") as a, MEAN("PT-2502") as b, MEAN("FT-2501") as c FROM "all_data" WHERE time > 1493328796387ms and time < 1493342639051ms GROUP BY time(1s) fill(linear))

This is being executed against a measurement "all_data" that has the fields required "PT-1601", etc.

When using the InfluxData API I am receiving the following error:

"System.AggregateException: One or more errors occurred. ---> InfluxData.Net.Common.Infrastructure.InfluxDataApiException: InfluxData API responded with status code=BadRequest, response={""error"":""error parsing query: found 16.7, expected ) at line 1, char 18""}

   at InfluxData.Net.Common.RequestClients.RequestClientBase.HandleIfErrorResponse(HttpStatusCode statusCode, String responseBody)
   at InfluxData.Net.Common.RequestClients.RequestClientBase.<RequestAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.RequestClients.InfluxDbRequestClient.<QueryAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.RequestClients.InfluxDbRequestClient.<GetQueryAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.ClientModules.ClientModuleBase.<ResolveSingleGetSeriesResultAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.ClientModules.BasicClientModule.<QueryAsync>d__4.MoveNext()
   --- End of inner exception stack trace ---
   at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
   at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
   at System.Threading.Tasks.Task`1.get_Result()
   at InfluxExcelAddin.InfluxDbInterface.GetQueryResult(String query)
   at InfluxExcelAddin.InfluxDbExcelFunctions.GetQueryResult_R(Object query)
---> (Inner Exception #0) InfluxData.Net.Common.Infrastructure.InfluxDataApiException: InfluxData API responded with status code=BadRequest, response={""error"":""error parsing query: found 16.7, expected ) at line 1, char 18""}

   at InfluxData.Net.Common.RequestClients.RequestClientBase.HandleIfErrorResponse(HttpStatusCode statusCode, String responseBody)
   at InfluxData.Net.Common.RequestClients.RequestClientBase.<RequestAsync>d__8.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.RequestClients.InfluxDbRequestClient.<QueryAsync>d__6.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.RequestClients.InfluxDbRequestClient.<GetQueryAsync>d__4.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.ClientModules.ClientModuleBase.<ResolveSingleGetSeriesResultAsync>d__16.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at InfluxData.Net.InfluxDb.ClientModules.BasicClientModule.<QueryAsync>d__4.MoveNext()<---
"

When I have a little time later, I can try and replicate the issue with a minimal database. Until then, if there's an obvious reason this query won't work, please let me know.

Add new queries to ClientSerieModule for accessing tag and field keys/values for a measurement

At present it is possible to query measurement tag keys, tag values, and field keys by just writing the following raw queries and executing them:

SHOW TAG KEYS FROM "measurement"

SHOW TAG VALUES FROM "measurement" WITH KEY = "tagKey"

SHOW FIELD KEYS FROM "measurement"

However it would be a lot more convenient if this interaction was promoted to native methods on the SerieClientModule:

IEnumerable<string> GetTagKeysAsync(string dbName, string measurementName);

IEnumerable<TagValue> GetTagValuesAsync(string dbName, string measurementName, string tagName);

IEnumerable<FieldKey> GetFieldKeysAsync(string dbName, string measurementName);

These methods are really useful for things such as populating values in a drop down in UI-driven applications: query tag keys -> bind to drop down -> value changed -> query tag values -> bind to list view. Otherwise this requires a bit of hard-coded response parsing every place you would want to explore these values/the schema of a measurement.

I have a feature branch in my fork where I've implemented these methods and the two new needed models TagValue and FieldKey. Let me know if you'd like a pull request. My changes around fixed Diagnostics parsing and Uptime parsing are included in this branch as well.

I would also like to add a UserClientModule and implement Show Users, Create User, Create Admin User, and Drop User. With these methods and the ones I've added above InfluxData.Net would implement more queries than the deprecated InfluxDB Web Admin Interface has in its Query Templates feature. These queries seem to be the last missing ones for completeness. Thoughts?

Facing error The underlying connection was closed: The connection was closed unexpectedly

I created one account on aiven and tried to access InfluxDB using following code:

        var influxDbClient = new InfluxDbClient("http://influx-3eb0406b.myName-aae2.aivencloud.com:15892/", "avnadmin", "PasswXXXXord", InfluxDbVersion.v_1_0_0);

        influxDbClient.Database.CreateDatabaseAsync("newDbName").Wait();

But it return error "The underlying connection was closed: The connection was closed unexpectedly"

" in string fields are not working

I cannot write string fields, if the string contains one ore more ". If I escape the " by myself e.g.

data.MessageContent.Replace(""", "\""))

then it's working correct.

I use Version 8.0.1

CreateBatchWriter method mistakenly awaited in the docs

According to the docs, one is supposed to create a BatchWriter like this:

var batchWriter = await influxDbClient.Serie.CreateBatchWriter("yourDbName");

However, the CreateBatchWriter method is not awaitable, and the await is thus invalid.

Continuous Query Double Quote Disallows Use of Regex

I am finding that this code public const string CreateContinuousQuerySubQuery = "SELECT {0} INTO \"{1}\" FROM {2} GROUP BY time({3}) {4} {5}"; in https://github.com/pootzko/InfluxData.Net/blob/master/InfluxData.Net.InfluxDb/Constants/QueryStatements.cs is basically preventing the use of a regex replacement in the creation of a continuous query by forcing the INTO measurement to have double quotes.

An example query pulled from https://www.influxdata.com/continuous-queries-in-influxdb-part-i/:
CREATE CONTINUOUS QUERY myquery ON testdb
BEGIN SELECT mean(value) INTO "policy1".:MEASUREMENT FROM /.*/ GROUP BY time(1h) END

I think the solution would be to stop the double quoting within the const string, but obviously, that has implications for those who already use this.

Inserting string values like "with space" result in "with\ space"

I'm not able to implement the following insert:
INSERT cpu,host=serverA,region=us_west value="with space"
or via REST:
curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu,host=server02 value="with space"

Could you verify and post a piece of code to not escape spaces with "\ "?

Massive multi-threaded writes uses up all tcp ports

I'm getting this error:
Unable to connect to the remote server ---> System.Net.Sockets.SocketException: Only one usage of each socket address (protocol/network address/port) is normally permitted

when I'm pushing the WriteAsync method hard from multiple threads. If I understand the error correctly it indicates that a new connection is created for each write. Is there a way where we can reuse an existing connection instead?

chunk_size

Hello
As with the request to establish the value chunk_size?

Backslash in field is not escaped

InfluxData.Net 5.0.7
.NET Framework 4.6.2
InfluxDB Server 1.0.2
Windows 10

Execute the following code:

var influxDbClient = new InfluxDbClient("http://localhost:8086/", "admin", "admin", InfluxDbVersion.v_1_0_0);
var point = new Point
{
    Name = "test",
    Fields = new Dictionary<string, object>
    {
        { "test", "backslash\\" },
    },
    Timestamp = DateTime.UtcNow,
};
await influxDbClient.Client.WriteAsync("test", point).ConfigureAwait(false);

According to Fiddler, the client sends the following message:

POST http://localhost:8086/write?u=admin&p=admin&db=test&precision=ms HTTP/1.1
User-Agent: InfluxData.Net.InfluxDb
Accept: application/json
Content-Type: text/plain; charset=utf-8
Host: bbe3f8a3.ngrok.io
Content-Length: 36
Expect: 100-continue

test test="backslash\" 1477673666571

The InfluxDB server responds with:

HTTP/1.1 400 Bad Request
Content-Type: application/json
Request-Id: 2fa76f0e-9d2f-11e6-bd37-000000000000
X-Influxdb-Version: 1.0.2
Date: Fri, 28 Oct 2016 16:54:26 GMT
Content-Length: 89

{"error":"unable to parse 'test test=\"backslash\\\" 1477673666571': unbalanced quotes"}

Select query somtimes returns "BadRequest"

Hi,

I am trying to select some data from InfluxDB and somtimes it fails.
The query can select some value before specific timestamp:
SELECT "Int" FROM "db" WHERE "TagName"='MachineStatusMessage.1' AND "time" < '2017-12-15T05:08:51Z' ORDER BY time DESC LIMIT 1

The data is there but the result is:

Exception Type: InfluxData.Net.Common.Infrastructure.InfluxDataApiException
Error message: InfluxData API responded with status code=BadRequest, response=query interrupted
Stack trace:
at InfluxData.Net.InfluxDb.Helpers.ResponseExtensions.Validate(QueryResponse queryResponse, Boolean throwOnWarning)
at InfluxData.Net.InfluxDb.ClientModules.ClientModuleBase.ResolveSingleGetSeriesResultChunked(IInfluxDataApiResponse response)
at InfluxData.Net.InfluxDb.ClientModules.ClientModuleBase.d__12.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at InfluxData.Net.InfluxDb.ClientModules.BasicClientModule.d__1.MoveNext()``

Any ideas what is happening here?

A password is required when creating an InfluxDbClient

When creating an InfluxDbClient, specifying null as username and password leads to an exception saying that a password is required.

I use HTTP basic auth for authentication and thus do not use username/password auth in InfluxDB. I think this use case should be supported.

Add support for netstandard + dotnet-core

As discussed in PR #35, we need to support dotnet-core

  • Convert solution to netstandard
  • Ensure compatibility with .NET 4.6+
  • Ensure compatibility with dotnet-core v1.x
  • Configure NuGet details in project properties (.csproj)
  • publish NuGet package update

Kapacitor - Create enabled tasks

Hi,
There is an option in kapacitor API to create a enabled task, in order to not have to do 2 request each time you create a task.
I was wondering if you can implement it. I'll be happy to submit a PR :)

InfluxDbClient.Diagnostics.GetDiagnosticsAsync() throws exception when parsing response

InfluxData.Net 5.0.7
.NET Framework 4.5.2
InfluxDB Server 1.0.2
Windows 7

InfluxDbClient.Diagnostics.GetDiagnosticsAsync() seems to be broken. I get a casting exception when calling the method. It looks like it is failing in DiagnosticsParser.GetDiagnosticsSystem() here:

var diagnosticsSystem = new DiagnosticsSystem()
{
    PID = serie.FirstRecordValueAs<long>("PID"),
    CurrentTime = DateTime.Parse(serie.FirstRecordValueAs<string>("currentTime")),
    Started = DateTime.Parse(serie.FirstRecordValueAs<string>("started")),
    Uptime = serie.FirstRecordValueAs<string>("uptime")
};

One of the time properties is failing to cast. By the way any reason to have Uptime be a string, versus say a TimeSpan?

Here's the exception and stack trace:

Unable to cast object of type 'System.DateTime' to type 'System.String'.

at InfluxData.Net.InfluxDb.Helpers.SerieExtensions.FirstRecordValueAs[T](Serie serie, String columnKey) in D:\projects\InfluxData.Net\InfluxData.Net.InfluxDb\Helpers\SerieExtensions.cs:line 23 at InfluxData.Net.InfluxDb.ResponseParsers.DiagnosticsParser.GetDiagnosticsSystem(IEnumerable`1 series) in D:\projects\InfluxData.Net\InfluxData.Net.InfluxDb\ResponseParsers\DiagnosticsParser.cs:line 49 at InfluxData.Net.InfluxDb.ResponseParsers.DiagnosticsParser.GetDiagnostics(IEnumerable`1 series) in D:\projects\InfluxData.Net\InfluxData.Net.InfluxDb\ResponseParsers\DiagnosticsParser.cs:line 35 at InfluxData.Net.InfluxDb.ClientModules.DiagnosticsClientModule.d__5.MoveNext() in D:\projects\InfluxData.Net\InfluxData.Net.InfluxDb\ClientModules\DiagnosticsClientModule.cs:line 54

If I get around to this I'll submit a pull request.

Create New RetentionPolicy

Thank you for your awesome library.
I try to use your influxData.Net in my project.
But I have some questions for using your library.

1.How to create retention policy not alter retention policy?
2.When creating continous query, how to create query like "CREATE CONTINUOUS QUERY cq_1 ON power_data BEGIN SELECT mean(value) AS "mean_value" INTO power_data.two_hours.TEMPERATURE FROM TEMPERATURE GROUP BY host,load,time(1m) END"? As it were, how to add "GROUP BY field ...." in continous query?

I hope your advice.

Allow specifying the timestamp precision when querying data

According to the Influxdb documentation (https://docs.influxdata.com/influxdb/v1.2/guides/querying_data/), it is possible to specify the timestamp format for query results by using the 'epoch' query string parameter in the corresponding HTTP request.
I believe this could be implemented in InfluxData.Net by adding an additional optional parameter for the epoch precision ([h,m,s,ms,u,ns]) to the query methods (or by adding further overloaded methods).
I'm willing to implement this if you are open to a pull request.

json string error:it would add '\' in the json string when reading data.

There is the json string in database:

 {"Name":"go\ to\ work"\,"Desception":"fighting!"\,"FinishTime":"2017-09-25T17:36:44.6631897+08:00"\,"AggregateId":"1ba4d283-4cd4-48ad-b04b-6c68bdeac784"\,"Version":2\,"Timestamp":"2017-09-24T17:36:45.173955+08:00"\,"EventType":"Shriek.Samples.Events.TodoChangedEvent"}

๐Ÿ˜ข what's wrong?

[Question] WriteAsync default behaviour

Greetings. I have a rather simple question. What happens when you try to call _client.Client.WriteAsync(point, "someNonexistentDb")? Will one be created for you? Or nothing will happen / an exception will be thrown?

Ability to handle chunked query responses ?

Is there a means to support chunked query responses, eg if I run a query that returns a large number of results, the values are limited to 10,000.
see https://docs.influxdata.com/influxdb/v1.2/guides/querying_data/#chunking

If I run this query on my db, it should return approx 500,000 results but only returns the first 10,000
select * from history where time > '2017-01-10' and time < '2017-02-10'

I tried adding the "chunked=true" option to the query string, but that results in an exception:
"InfluxData API responded with status code=BadRequest, response={"error":"error parsing query: found chunked, expected ; at line 1, char 91"}"

Missing UrlEncoding of database name and query

I have a Influx database called 'XXX+' and some measurements called 'XXX+YYY'. InfluxData.Net failes to read this data because the database name and the query is not URL encoded. This means that the "+" is passed directly to influxdb, which URL decodes the "+" to space.

Would it be possible to fix this?

Functionality to allow waiting for an IBatchWriter to finish

Would it be possible to add functionality for waiting for an IBatchWriter to finish writing? There are many ways this could be made possible, for example:

  1. A blocking .stop() method.

  2. A .size() method for determining how many unsent entries the IBatchWriter has enqueued.

  3. Some async/await magic.

Or perhaps there is already some way of doing this that I am missing?

Internal Server Error

I am processing a csv file whose each column maps to a metric. I am sending the fields in a single row in bulk via the WriteSync method.
One row, typically has around 500 points.

When i try to process the lines which i have read in memory in parallel, via code like following:
Parallel.ForEach(lines.Skip(1),new ParallelOptions() { MaxDegreeOfParallelism = 5 }, line =>
{
try
{
TransformLine(line, columnHeaderInfo.ColumnHeaders);
}
catch (Exception exp)
{
exceptions.Enqueue(exp);
}
});

i start getting Internal Server Error, even with Parallelism set to only 5. Are there any settings i need to ensure in my influxdb.conf file? Any help in resolving this will be highly appreciated.

Currently to process a 4 MB file, it takes around 11 mins.

Connect with SSL

Is there a way to use https with an self signed certificate?
I didn't find a solution right now.

System.Net.Http wrong version.

InfluxData.Net uses System.Net.Http 4.1.1.1

If I just require the latest version (v8) via nugget, and then use the .net 4.6.1 I am getting errors that the version of System.Net.Http is not the one in the manifest.

I solved the issue by cloning the library and then referencing all the dlls of the library including System.Net.Http and Newtonsoft.Json as they came out from the compiler for the library.
That is a hack.

It should work straight out of the box via nuget or paket.

I assume there must be a way how to make a declaration in app.config to use a newer version of System.Net.Http; but I was unable to do so.

I should note that when I was adding the references for System.Net.Http I often got multiple System.Net.Http references added; and I then had to delete the newer one.

I assume the issue is either in InflusData.NEt library or in the usage of Newtonsoft.Json.

Batching of writes

I have a few apps that will write high volumes of points from a single application. It would be good if I could just write these and they would be batched internally in InfluxData.

If you like the idea and can point me in the right direction I can look at implementing a WriteBatched method that will allow the batching of data to be written per database.

Proper Method for Writing Points

In your Readme.md you have a section demonstrating how to Write Points using a Serie builder. I assume this should have been Series but it appears this was carried over form the previous repo.

Write

var _client = new InfluxDb("http://...:8086", "root", "root");
Serie serie = new Serie.Builder("testSeries")
                .Columns("value1", "value2")
                .Values(DateTime.Now.Millisecond, 5)
                .Build();
InfluxDbApiResponse writeResponse =await _client.WriteAsync("MyDb", TimeUnit.Milliseconds, serie);

However, it appears from exploring your definition that you should instead be writing a single point or an Array of point

Can you please comment on the proper way to write single points and or bulk points. It seems the method of adding a single point or an array of points is much cleaner and more manageable.

Use form data to submit query

Hi all,
I recently ran into an issue with long queries (requesting a lot of fields) where the URI that is being constructed gets too long and due to the "q=" parameter that has more than 64000 characters the request is rejected ("URI too long").

Though I admit that maybe that type of query is questionable, I found out that InfluxDB also reads the query parameter from multipart form data (see influxdata/influxdb@f58a50c)

With the following code I was able to successfully submit a longer query to InfluxDB:

HttpClient client = new HttpClient();
MultipartFormDataContent form = new MultipartFormDataContent();
form.Add(new StringContent("..."), "u");
form.Add(new StringContent("..."), "p");
form.Add(new StringContent(reallyLargeQuery), "q");
string url = $"http://localhost:8086/query?db={this.database}";

client.PostAsync(url, form)

Would that be something that could be changed in this client?

InfluxData API responded with status code=InternalServerError, response=json: cannot unmarshal number into Go value of type struct { Points ...

The error message below is what the influx server returns back to the .net Client: InfluxData API responded with status code=InternalServerError, response={"error":"json: cannot unmarshal number into Go value of type struct { Points ...

The server version 0.9 is running on windows

        IDictionary<string, object> fields = new Dictionary<string, object> { { "Severity", 0 } };
        IDictionary<string, object> tags = new Dictionary<string, object> { { "HK", "HK20" }, { "SRO", "SRO2" } };

       InfluxData.Net.InfluxDb.Models.Point point =
                            new InfluxData.Net.InfluxDb.Models.Point()
                            { 
                                Name = pointName, // "alarm-connected-to-bit",
                                Tags = tags,
                                Fields = fields,
                                Timestamp = timestamp
                            };

        return await client.Client.WriteAsync(databaseName, point);

Setting precision=TimeUnit.Seconds in WriteAsync() results in Error

To reproduce:
Use the WriteAsync example from README.MD, change the line with WriteAsync call to:

var response = await influxDbClient.Client.WriteAsync("yourDbName", pointToWrite**, null, TimeUnit.Seconds**);

Error:
InfluxData API responded with status code=BadRequest, response={"error":"unable
to parse 'tests,SensorId=8,SerialNumber=00AF123B SensorState="act",Humidity=43
1i,Temperature=22.1,Resistance=34957i 1473837346998': time outside range -922337
2036854775806 - 9223372036854775806"
}

Parse Kapacitor task "Stats"

It's a new property supported by Kapacitor. Should be added to InfluxData.Net.Kapacitor.Models.Responses.KapacitorTask.

UserResponseParser.GetUsers() throws an exception when no users have been defined on the server

If you call GetUsersAsync() on the UserClientModule when no users have been defined on the InfluxDB server the UserResponseParser.GetUsers() method will throw an unhandled exception.

The code tries to send back an empty list when there are no results by copying the same technique from other response parsers but in this case the InfluxDB server returns a series with no values which doesn't get caught by the current conditional logic.

The fix is pretty simple and I've submitted pull request #33 to address it.

receiving error on writing

Hi Project.
Using this piece of code:

foreach (var myClassofBasicStrings in ListOf_myClassofBasicStrings)
{

    var pointToWrite = new Point()
    {
        Name = serie, // serie/measurement/table to write into
        Tags = new Dictionary<string, object>()
        {
            { "Tag1", "Value1" }
        },

        Fields = myClassofBasicStrings.GetType()
        .GetProperties(BindingFlags.Instance | BindingFlags.Public)
            .ToDictionary(prop => prop.Name, prop => prop.GetValue(myClassofBasicStrings, null)),

        Timestamp = DateTime.UtcNow  // optional (can be set to any DateTime moment)
    };

    pointsToWrite.Add(pointToWrite);
}

var response = client.Client.WriteAsync(pointsToWrite, dbname);

When calling the write I receive: Value cannot be null. Parameter name: value
Any ideas? The points seems valid with valid data. Each point has a 'name' attribute set.
Thanks,
Ronald

Deprecated use of 'CREATE CONTINUOUS QUERY

Noticed this in the "CreateContinuousQuery_OnExistingCqName_ShouldThrow" test for v1.0.0:

Body: "{\"results\":[{\"messages\":[{\"level\":\"warning\",\"text\":\"deprecated use of 'CREATE CONTINUOUS QUERY FakeCq1467326739350853020235 ON FakeInfluxDb14673267283812050619918 BEGIN SELECT max(field_int) AS max_field_int, min(field_int) AS min_field_int INTO FakeInfluxDb14673267283812050619918.autogen.\\\"FakeMeasurement14673267393031592682186.5s\\\" FROM FakeInfluxDb14673267283812050619918.autogen.FakeMeasurement14673267393031592682186 GROUP BY time(5s) fill(previous) END' in a read only context, please use a POST request instead\"}]}]}"
StatusCode: OK
Success: true

Other requests should probably also be checked for deprecated InfluxDB syntax.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.