Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Agent/NewRelic/Agent/Core/Agent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,11 @@ public void RecordCountMetric(string metricName, long count = 1)
_agentHealthReporter.ReportCountMetric(metricName, count);
}

public void RecordGaugeMetric(string metricName, float value)
{
_agentHealthReporter.ReportGaugeMetric(metricName, value);
}

public void RecordByteMetric(string metricName, long totalBytes, long? exclusiveBytes = null)
{
_agentHealthReporter.ReportByteMetric(metricName, totalBytes, exclusiveBytes);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,12 @@ public void ReportByteMetric(string metricName, long totalBytes, long? exclusive
TrySend(metric);
}

public void ReportGaugeMetric(string metricName, float value)
{
var metric = _metricBuilder.TryBuildGaugeMetric(metricName, value);
TrySend(metric);
}



public void ReportDotnetVersion()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ public interface IAgentHealthReporter : IOutOfBandMetricSource

void ReportSupportabilityCountMetric(string metricName, long count = 1);
void ReportCountMetric(string metricName, long count = 1);
void ReportGaugeMetric(string metricName, float value);

void ReportInfiniteTracingSpanResponseError();
void ReportInfiniteTracingSpanEventsSeen(long count = 1);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ public interface IMetricBuilder

MetricWireModel TryBuildCountMetric(string metricName, long count);
MetricWireModel TryBuildByteMetric(string metricName, long totalBytes, long? exclusiveBytes = null);
MetricWireModel TryBuildGaugeMetric(string metricName, float value);

MetricWireModel TryBuildDistributedTraceHeadersAcceptedLate(int acceptedLateCount);
}
6 changes: 6 additions & 0 deletions src/Agent/NewRelic/Agent/Core/WireModels/MetricWireModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1039,6 +1039,12 @@ public MetricWireModel TryBuildByteMetric(string metricName, long totalBytes, lo
return BuildMetric(_metricNameService, metricName, null, data);
}

public MetricWireModel TryBuildGaugeMetric(string metricName, float value)
{
var data = MetricDataWireModel.BuildGaugeValue(value);
return BuildMetric(_metricNameService, metricName, null, data);
}

#endregion
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ public interface IAgentExperimental
/// <param name="metricName"></param>
/// <param name="count"></param>
void RecordCountMetric(string metricName, long count = 1);

/// <summary>
/// Records a gauge metric with the given name, representing a point-in-time value
/// </summary>
/// <param name="metricName"></param>
/// <param name="value"></param>
void RecordGaugeMetric(string metricName, float value);

/// <summary>
/// Records a byte count metric with the given name
/// </summary>
Expand Down
Loading
Loading