Package com.tnsai.llm.observability
Record Class LLMMetrics.ProviderMetrics
java.lang.Object
java.lang.Record
com.tnsai.llm.observability.LLMMetrics.ProviderMetrics
- Enclosing class:
LLMMetrics
public static record LLMMetrics.ProviderMetrics(long requests, long responses, long errors, long inputTokens, long outputTokens, double estimatedCost, double avgLatencyMs, long streamChunks)
extends Record
Per-provider metrics.
-
Constructor Summary
ConstructorsConstructorDescriptionProviderMetrics(long requests, long responses, long errors, long inputTokens, long outputTokens, double estimatedCost, double avgLatencyMs, long streamChunks) Creates an instance of aProviderMetricsrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondoubleReturns the value of theavgLatencyMsrecord component.final booleanIndicates whether some other object is "equal to" this one.doublelongerrors()Returns the value of theerrorsrecord component.doubleReturns the value of theestimatedCostrecord component.final inthashCode()Returns a hash code value for this object.longReturns the value of theinputTokensrecord component.longReturns the value of theoutputTokensrecord component.longrequests()Returns the value of therequestsrecord component.longReturns the value of theresponsesrecord component.longReturns the value of thestreamChunksrecord component.doublefinal StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
ProviderMetrics
public ProviderMetrics(long requests, long responses, long errors, long inputTokens, long outputTokens, double estimatedCost, double avgLatencyMs, long streamChunks) Creates an instance of aProviderMetricsrecord class.- Parameters:
requests- the value for therequestsrecord componentresponses- the value for theresponsesrecord componenterrors- the value for theerrorsrecord componentinputTokens- the value for theinputTokensrecord componentoutputTokens- the value for theoutputTokensrecord componentestimatedCost- the value for theestimatedCostrecord componentavgLatencyMs- the value for theavgLatencyMsrecord componentstreamChunks- the value for thestreamChunksrecord component
-
-
Method Details
-
successRate
public double successRate() -
errorRate
public double errorRate() -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with '=='. -
requests
public long requests()Returns the value of therequestsrecord component.- Returns:
- the value of the
requestsrecord component
-
responses
public long responses()Returns the value of theresponsesrecord component.- Returns:
- the value of the
responsesrecord component
-
errors
public long errors()Returns the value of theerrorsrecord component.- Returns:
- the value of the
errorsrecord component
-
inputTokens
public long inputTokens()Returns the value of theinputTokensrecord component.- Returns:
- the value of the
inputTokensrecord component
-
outputTokens
public long outputTokens()Returns the value of theoutputTokensrecord component.- Returns:
- the value of the
outputTokensrecord component
-
estimatedCost
public double estimatedCost()Returns the value of theestimatedCostrecord component.- Returns:
- the value of the
estimatedCostrecord component
-
avgLatencyMs
public double avgLatencyMs()Returns the value of theavgLatencyMsrecord component.- Returns:
- the value of the
avgLatencyMsrecord component
-
streamChunks
public long streamChunks()Returns the value of thestreamChunksrecord component.- Returns:
- the value of the
streamChunksrecord component
-