Class: Insika::Telemetry::Recorder::Instruments
- Inherits:
-
Object
- Object
- Insika::Telemetry::Recorder::Instruments
- Defined in:
- lib/insika/telemetry/recorder.rb
Overview
The metric instruments of the convention, created once per Recorder. Names and units are part of the documented contract (docs/OBSERVABILITY.md) — renaming one breaks every dashboard built on it.
Instance Attribute Summary collapse
-
#cost ⇒ Object
readonly
Returns the value of attribute cost.
-
#tokens ⇒ Object
readonly
Returns the value of attribute tokens.
-
#tool_calls ⇒ Object
readonly
Returns the value of attribute tool_calls.
-
#tool_duration ⇒ Object
readonly
Returns the value of attribute tool_duration.
-
#turn_duration ⇒ Object
readonly
Returns the value of attribute turn_duration.
-
#turns ⇒ Object
readonly
Returns the value of attribute turns.
Instance Method Summary collapse
-
#initialize(meter) ⇒ Instruments
constructor
A new instance of Instruments.
Constructor Details
#initialize(meter) ⇒ Instruments
Returns a new instance of Instruments.
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/insika/telemetry/recorder.rb', line 45 def initialize(meter) @turns = meter.create_counter("insika.turns", unit: "{turn}", description: "Turns completed, by outcome") @turn_duration = meter.create_histogram("insika.turn.duration", unit: "s", description: "Wall time of a turn") @tokens = meter.create_counter("insika.tokens", unit: "{token}", description: "Tokens consumed, by type") @cost = meter.create_counter("insika.cost", unit: "{USD}", description: "Estimated turn cost in USD") @tool_calls = meter.create_counter("insika.tool.calls", unit: "{call}", description: "Tool invocations") @tool_duration = meter.create_histogram("insika.tool.duration", unit: "s", description: "Wall time of a tool call") end |
Instance Attribute Details
#cost ⇒ Object (readonly)
Returns the value of attribute cost.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def cost @cost end |
#tokens ⇒ Object (readonly)
Returns the value of attribute tokens.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def tokens @tokens end |
#tool_calls ⇒ Object (readonly)
Returns the value of attribute tool_calls.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def tool_calls @tool_calls end |
#tool_duration ⇒ Object (readonly)
Returns the value of attribute tool_duration.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def tool_duration @tool_duration end |
#turn_duration ⇒ Object (readonly)
Returns the value of attribute turn_duration.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def turn_duration @turn_duration end |
#turns ⇒ Object (readonly)
Returns the value of attribute turns.
43 44 45 |
# File 'lib/insika/telemetry/recorder.rb', line 43 def turns @turns end |