Skip to content

Commit

Permalink
Change NodeLoadMetricInformation properties from int to double (#137)
Browse files Browse the repository at this point in the history
The following properties changed type from int to double because they
were previously incorrectly defined in the swagger spec.
- currentNodeLoad
- nodeCapacityRemaining
- bufferedNodeCapacityRemaining
- plannedNodeLoadRemoval

Increment major package version because property type change is a
breaking change.
  • Loading branch information
olegsych authored Sep 24, 2024
1 parent 2ea6f06 commit 363e980
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions properties/service_fabric_common.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

<!-- Version for binaries, nuget packages generated from this repo. -->
<!-- TODO: Versions numbers are changed here manually for now, Integrate this with GitVersion. -->
<MajorVersion>4</MajorVersion>
<MinorVersion>12</MinorVersion>
<MajorVersion>5</MajorVersion>
<MinorVersion>0</MinorVersion>
<BuildVersion>0</BuildVersion>
<Revision>0</Revision>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ internal static NodeLoadMetricInformation GetFromJsonProperties(JsonReader reade
var isCapacityViolation = default(bool?);
var nodeBufferedCapacity = default(string);
var nodeRemainingBufferedCapacity = default(string);
var currentNodeLoad = default(int?);
var nodeCapacityRemaining = default(int?);
var bufferedNodeCapacityRemaining = default(int?);
var plannedNodeLoadRemoval = default(int?);
var currentNodeLoad = default(double?);
var nodeCapacityRemaining = default(double?);
var bufferedNodeCapacityRemaining = default(double?);
var plannedNodeLoadRemoval = default(double?);

do
{
Expand Down Expand Up @@ -78,19 +78,19 @@ internal static NodeLoadMetricInformation GetFromJsonProperties(JsonReader reade
}
else if (string.Compare("CurrentNodeLoad", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
currentNodeLoad = reader.ReadValueAsInt();
currentNodeLoad = reader.ReadValueAsDouble();
}
else if (string.Compare("NodeCapacityRemaining", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
nodeCapacityRemaining = reader.ReadValueAsInt();
nodeCapacityRemaining = reader.ReadValueAsDouble();
}
else if (string.Compare("BufferedNodeCapacityRemaining", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
bufferedNodeCapacityRemaining = reader.ReadValueAsInt();
bufferedNodeCapacityRemaining = reader.ReadValueAsDouble();
}
else if (string.Compare("PlannedNodeLoadRemoval", propName, StringComparison.OrdinalIgnoreCase) == 0)
{
plannedNodeLoadRemoval = reader.ReadValueAsInt();
plannedNodeLoadRemoval = reader.ReadValueAsDouble();
}
else
{
Expand Down Expand Up @@ -159,22 +159,22 @@ internal static void Serialize(JsonWriter writer, NodeLoadMetricInformation obj)

if (obj.CurrentNodeLoad != null)
{
writer.WriteProperty(obj.CurrentNodeLoad, "CurrentNodeLoad", JsonWriterExtensions.WriteIntValue);
writer.WriteProperty(obj.CurrentNodeLoad, "CurrentNodeLoad", JsonWriterExtensions.WriteDoubleValue);
}

if (obj.NodeCapacityRemaining != null)
{
writer.WriteProperty(obj.NodeCapacityRemaining, "NodeCapacityRemaining", JsonWriterExtensions.WriteIntValue);
writer.WriteProperty(obj.NodeCapacityRemaining, "NodeCapacityRemaining", JsonWriterExtensions.WriteDoubleValue);
}

if (obj.BufferedNodeCapacityRemaining != null)
{
writer.WriteProperty(obj.BufferedNodeCapacityRemaining, "BufferedNodeCapacityRemaining", JsonWriterExtensions.WriteIntValue);
writer.WriteProperty(obj.BufferedNodeCapacityRemaining, "BufferedNodeCapacityRemaining", JsonWriterExtensions.WriteDoubleValue);
}

if (obj.PlannedNodeLoadRemoval != null)
{
writer.WriteProperty(obj.PlannedNodeLoadRemoval, "PlannedNodeLoadRemoval", JsonWriterExtensions.WriteIntValue);
writer.WriteProperty(obj.PlannedNodeLoadRemoval, "PlannedNodeLoadRemoval", JsonWriterExtensions.WriteDoubleValue);
}

writer.WriteEndObject();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ public NodeLoadMetricInformation(
bool? isCapacityViolation = default(bool?),
string nodeBufferedCapacity = default(string),
string nodeRemainingBufferedCapacity = default(string),
int? currentNodeLoad = default(int?),
int? nodeCapacityRemaining = default(int?),
int? bufferedNodeCapacityRemaining = default(int?),
int? plannedNodeLoadRemoval = default(int?))
double? currentNodeLoad = default(double?),
double? nodeCapacityRemaining = default(double?),
double? bufferedNodeCapacityRemaining = default(double?),
double? plannedNodeLoadRemoval = default(double?))
{
this.Name = name;
this.NodeCapacity = nodeCapacity;
Expand Down Expand Up @@ -103,23 +103,23 @@ public NodeLoadMetricInformation(
/// <summary>
/// Gets current load on the node for this metric.
/// </summary>
public int? CurrentNodeLoad { get; }
public double? CurrentNodeLoad { get; }

/// <summary>
/// Gets the remaining capacity on the node for the metric.
/// </summary>
public int? NodeCapacityRemaining { get; }
public double? NodeCapacityRemaining { get; }

/// <summary>
/// Gets the remaining capacity which is not reserved by NodeBufferPercentage for this metric on the node.
/// </summary>
public int? BufferedNodeCapacityRemaining { get; }
public double? BufferedNodeCapacityRemaining { get; }

/// <summary>
/// Gets this value represents the load of the replicas that are planned to be removed in the future.
/// This kind of load is reported for replicas that are currently being moving to other nodes and for replicas that are
/// currently being dropped but still use the load on the source node.
/// </summary>
public int? PlannedNodeLoadRemoval { get; }
public double? PlannedNodeLoadRemoval { get; }
}
}

0 comments on commit 363e980

Please sign in to comment.