NoOpTrace class final

A no-op implementation of Trace that can be used for development or testing.

This trace implementation does nothing when its methods are called. It is returned by NoOpTelemetryProvider when starting a trace.

All operations are implemented as no-ops:

Example:

final trace = await telemetry.startTrace('MyOperation', 'Start');
await doSomething();
await trace.stop(); // Does nothing with NoOpTrace
Inheritance

Constructors

NoOpTrace.new()

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

getAttributes() Map<String, String>
Gets all attributes set so far in the trace.
override
getMetric(String name) int
Gets a metric with a specific name.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setAttributes(Map<String, String> attributes) → void
Sets an attribute with a specific name and value.
override
setMetric(String name, int value) → void
Sets a metric with a specific name and value.
override
startChild(String name, String operation, {LogLevel? level = LogLevel.info}) Future<Trace>
Starts a child trace with a specific name and operation.
override
stop() Future<void>
Stops or finalizes the trace.
override
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited