PragmaticFlow / NBomber.Sinks.InfluxDB

A NBomber sink that writes statistics to InfluxDB
Apache License 2.0
7 stars 9 forks source link

Org and Bucket values from Url configuration parameter are overwritten #15

Closed askrinnik closed 10 months ago

askrinnik commented 10 months ago

Steps to reproduce:

Use settings from the example.

{
  "InfluxDBSink": {
    "Url": "http://localhost:8086?org=MyOrg&bucket=NBomber",
    "Token": "N3Z_uUDSQ61qVp93K5dNzH3rbNcKxtphDLrjfS_DcX2cdTr3nR2pOlixGCx6HQ8VI66nqnyztOlPFoWFXoe62Q==",
    "CustomTags": [
      {
        "Key": "environment",
        "Value": "linux"
      }
    ]
  }
}

Data are not saved to the InfluxDb database.

There is an error in a log file:

2023-11-13 02:10:31.020 -06:00 [WRN] [ThreadId:10] Reporting sink: NBomber.Sinks.InfluxDB failed to save realtime scenario stats
System.ArgumentException: Expecting a non-empty string for 'bucket' parameter. Please specify the bucket as a method parameter or use default configuration at 'InfluxDBClientOptions.Bucket'.
   at InfluxDB.Client.Core.Arguments.CheckNonEmptyString(String value, String name)
   at InfluxDB.Client.BatchWriteOptions..ctor(String bucket, String org, WritePrecision precision)
   at InfluxDB.Client.WriteApiAsync.WritePointsAsync(List`1 points, String bucket, String org, CancellationToken cancellationToken)
   at NBomber.DomainServices.TestHost.ReportingSinks.saveRealtimeStats@40.MoveNext()

A root cause of the issue:

The Organd Bucket properties are successfully initialized from the Urlconfiguration parameter. But then they are overwritten by empty config values.

AntyaDev commented 10 months ago

Hi @askrinnik ,

Thanks for your input! Is this bug reproducible on InfluxDB v2?

AntyaDev commented 10 months ago

@askrinnik please try this version: 5.0.2-beta.0

askrinnik commented 10 months ago

Yes, that works. Thanks a lot!