NoOpTracing

org.llm4s.trace.NoOpTracing
class NoOpTracing extends Tracing

No-operation Tracing implementation that silently discards all events.

All methods return Right(()) immediately without performing any operations. Use this implementation when tracing is disabled or not needed.

== Usage ==

val tracing: Tracing = new NoOpTracing()

// All operations succeed silently
tracing.traceEvent(TraceEvent.CustomEvent("test", ujson.Obj())) // Returns Right(())
tracing.traceError(new Exception("ignored")) // Returns Right(())

== Use Cases ==

  • Production environments where tracing overhead is undesirable
  • Unit tests that don't need trace output
  • Default fallback when no tracing is configured

Attributes

See also

ConsoleTracing for development/debugging

LangfuseTracing for production observability

Graph
Supertypes
trait Tracing
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def traceAgentState(state: AgentState): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

def traceCompletion(completion: Completion, model: String): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

def traceError(error: Throwable, context: String): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

def traceEvent(event: TraceEvent): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

def traceTokenUsage(usage: TokenUsage, model: String, operation: String): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

def traceToolCall(toolName: String, input: String, output: String): Result[Unit]

Always returns Right(()) without side effects.

Always returns Right(()) without side effects.

Attributes

Inherited methods

final def traceCost(costUsd: Double, model: String, operation: String, tokenCount: Int, costType: String): Result[Unit]

Trace cost in USD for any operation.

Trace cost in USD for any operation.

Value parameters

costType

Category: "embedding", "completion", "total"

costUsd

Cost in US dollars

model

Model name

operation

Type: "embedding", "completion", "evaluation"

tokenCount

Total tokens used

Attributes

Inherited from:
Tracing
final def traceEmbeddingUsage(usage: EmbeddingUsage, model: String, operation: String, inputCount: Int): Result[Unit]

Trace embedding token usage for cost tracking.

Trace embedding token usage for cost tracking.

Value parameters

inputCount

Number of texts embedded

model

Embedding model name

operation

Type: "indexing", "query", "evaluation"

usage

Token usage from embedding operation

Attributes

Inherited from:
Tracing
final def traceEvent(event: String): Result[Unit]

Attributes

Inherited from:
Tracing
final def traceRAGOperation(operation: String, durationMs: Long, embeddingTokens: Option[Int], llmPromptTokens: Option[Int], llmCompletionTokens: Option[Int], totalCostUsd: Option[Double]): Result[Unit]

Trace completion of a RAG operation with metrics.

Trace completion of a RAG operation with metrics.

Value parameters

durationMs

Duration in milliseconds

embeddingTokens

Optional embedding token count

llmCompletionTokens

Optional LLM completion tokens

llmPromptTokens

Optional LLM prompt tokens

operation

Type: "index", "search", "answer", "evaluate"

totalCostUsd

Optional total cost in USD

Attributes

Inherited from:
Tracing