Skip to content

Commit

Permalink
Add gas prices to graphana
Browse files Browse the repository at this point in the history
  • Loading branch information
benaadams committed Dec 19, 2024
1 parent 94815d5 commit fbff93a
Showing 1 changed file with 72 additions and 4 deletions.
76 changes: 72 additions & 4 deletions src/Nethermind/Nethermind.Evm/Metrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -148,10 +148,78 @@ public class Metrics
internal static float EstMedianGasPrice { get; set; }

internal static long BlockTransactions { get; set; }
internal static float BlockAveGasPrice { get; set; }
internal static float BlockMinGasPrice { get; set; } = float.MaxValue;
internal static float BlockMaxGasPrice { get; set; }
internal static float BlockEstMedianGasPrice { get; set; }

private static float _blockAveGasPrice;
internal static float BlockAveGasPrice
{
get => _blockAveGasPrice;
set
{
_blockAveGasPrice = value;
if (value != 0)
{
GasPriceAve = value;
}
}
}

private static float _blockMinGasPrice = float.MaxValue;
internal static float BlockMinGasPrice
{
get => _blockMinGasPrice;
set
{
_blockMinGasPrice = value;
if (_blockMinGasPrice != float.MaxValue)
{
GasPriceMin = value;
}
}
}

private static float _blockMaxGasPrice;
internal static float BlockMaxGasPrice
{
get => _blockMaxGasPrice;
set
{
_blockMaxGasPrice = value;
if (value != 0)
{
GasPriceMax = value;
}
}
}

private static float _blockEstMedianGasPrice;
internal static float BlockEstMedianGasPrice
{
get => _blockEstMedianGasPrice;
set
{
_blockEstMedianGasPrice = value;
if (value != 0)
{
GasPriceMedian = value;
}
}
}

[GaugeMetric]
[Description("Minimum tx gas price in block")]
public static float GasPriceMin { get; private set; }

[GaugeMetric]
[Description("Median tx gas price in block")]
public static float GasPriceMedian { get; private set; }

[GaugeMetric]
[Description("Mean tx gas price in block")]
public static float GasPriceAve { get; private set; }

[GaugeMetric]
[Description("Maximum tx gas price in block")]
public static float GasPriceMax { get; private set; }

public static void ResetBlockStats()
{
Expand Down

0 comments on commit fbff93a

Please sign in to comment.