Skip to content

Commit

Permalink
added "cluster_id" tag
Browse files Browse the repository at this point in the history
added "cluster_node" metric point
  • Loading branch information
AntyaDev committed Jun 30, 2022
1 parent 9693875 commit 5d53822
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
24 changes: 19 additions & 5 deletions src/NBomber.Sinks.InfluxDB/InfluxDBSink.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ type InfluxDBSink(influxClient: InfluxDBClient, customTags: CustomTag[]) =
.Tag("node_type", nodeType)
.Tag("test_suite", testInfo.TestSuite)
.Tag("test_name", testInfo.TestName)
.Tag("cluster_id", testInfo.ClusterId)

let addScenarioInfoTags (scnStats: ScenarioStats) (stepName: string) (point: PointData) =
let operation = getOperationName(scnStats.CurrentOperation)
Expand Down Expand Up @@ -190,7 +191,7 @@ type InfluxDBSink(influxClient: InfluxDBClient, customTags: CustomTag[]) =
|> Option.map(fun client ->
let writeApi = client.GetWriteApiAsync()

PointData.Measurement("nbomber").Field("start_session", true)
PointData.Measurement("nbomber").Field("cluster_node", 1)
|> addTestInfoTags _context
|> addCustomTags _customTags
|> writeApi.WritePointAsync
Expand All @@ -202,9 +203,22 @@ type InfluxDBSink(influxClient: InfluxDBClient, customTags: CustomTag[]) =
|> Option.map(fun client ->
let writeApi = client.GetWriteApiAsync()

stats
|> Array.collect (mapScenarioStats _context _customTags)
|> writeApi.WritePointsAsync
let writeRealtimeStats =
stats
|> Array.collect (mapScenarioStats _context _customTags)
|> writeApi.WritePointsAsync

let writeLatencyCounts =
stats
|> Array.collect (mapLatencyCount _context _customTags)
|> writeApi.WritePointsAsync

let writeStatusCodes =
stats
|> Array.collect (mapStatusCodes _context _customTags)
|> writeApi.WritePointsAsync

Task.WhenAll(writeRealtimeStats, writeLatencyCounts, writeStatusCodes)
)
|> Option.defaultValue Task.CompletedTask

Expand Down Expand Up @@ -237,7 +251,7 @@ type InfluxDBSink(influxClient: InfluxDBClient, customTags: CustomTag[]) =
|> Option.map(fun client ->
let writeApi = client.GetWriteApiAsync()

PointData.Measurement("nbomber").Field("stop_session", true)
PointData.Measurement("nbomber").Field("cluster_node", 0)
|> addTestInfoTags _context
|> addCustomTags _customTags
|> writeApi.WritePointAsync
Expand Down
8 changes: 4 additions & 4 deletions src/NBomber.Sinks.InfluxDB/NBomber.Sinks.InfluxDB.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<Version>3.0.0-beta.10</Version>
<Version>3.0.0-beta.11</Version>
<Authors>PragmaticFlow</Authors>
<Copyright>PragmaticFlow@2021</Copyright>
<PackageTags>load-testing, performance-testing, integration-testing, influxdb, fsharp</PackageTags>
Expand All @@ -23,9 +23,9 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="InfluxDB.Client" Version="3.1.0" />
<PackageReference Include="NBomber" Version="3.0.0-beta.10" />
<PackageReference Update="FSharp.Core" Version="6.0.3" />
<PackageReference Include="InfluxDB.Client" Version="4.3.0" />
<PackageReference Include="NBomber.Contracts" Version="3.0.0-beta.11" />
<PackageReference Update="FSharp.Core" Version="6.0.5" />
</ItemGroup>

</Project>

0 comments on commit 5d53822

Please sign in to comment.