guidellm.collectors.collector
Base classes for collectors that gather data while each benchmark runs.
A collector is created from its :class:CollectorArgs, started when a benchmark begins and stopped when it ends, then asked for one result covering that benchmark's measurement window. Collectors run in their own process, managed by :class:~guidellm.collectors.process.CollectorProcess, so they never take time from the benchmark's main process.
Collector
Bases: RegistryMixin[type['Collector']], ABC
Gather data from outside GuideLLM for each benchmark of a run.
A collector is reused across the benchmarks of a run. For each benchmark, :meth:start is called before its requests begin, :meth:stop after they end, and :meth:result once the measurement window is known. Every collector returns a result for every benchmark, even an empty one, so results line up with the order the collectors were configured in.
Source code in src/guidellm/collectors/collector.py
__init__(kind)
close() async
from_args(args) abstractmethod classmethod
Create a collector from its arguments.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | CollectorArgs | Arguments for this collector's kind | required |
Returns:
| Type | Description |
|---|---|
Collector | The configured collector |
resolve(args) classmethod
Resolve collector arguments into a collector.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
args | CollectorArgs | Collector arguments with a registered kind | required |
Returns:
| Type | Description |
|---|---|
Collector | The configured collector |
Raises:
| Type | Description |
|---|---|
ValueError | If the kind is not registered |
Source code in src/guidellm/collectors/collector.py
result(start_time, end_time) abstractmethod
Return the result for the latest benchmark.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_time | float | Start of the measurement window in seconds since epoch | required |
end_time | float | End of the measurement window in seconds since epoch | required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | JSON-serializable result, which may be empty |
Source code in src/guidellm/collectors/collector.py
start() abstractmethod async
OneshotCollector
Bases: Collector, ABC
Collect once per benchmark, after its requests have ended.
Suited to data that does not change during a benchmark, such as a server's configuration. It is still collected for every benchmark, since a run's benchmarks may be configured differently.
Source code in src/guidellm/collectors/collector.py
__init__(kind)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind | str | The kind this collector was configured with | required |
collect() abstractmethod async
Collect this benchmark's data.
Returns:
| Type | Description |
|---|---|
dict[str, Any] | JSON-serializable result, which may be empty |
result(start_time, end_time)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_time | float | Start of the measurement window in seconds since epoch | required |
end_time | float | End of the measurement window in seconds since epoch | required |
Returns:
| Type | Description |
|---|---|
dict[str, Any] | The result collected when the benchmark ended |
Source code in src/guidellm/collectors/collector.py
start() async
PeriodicCollector
Bases: Collector, ABC
Sample at a fixed interval while a benchmark runs.
Samples once when the benchmark starts, every interval seconds while it runs, and once more when it stops, so the measurement window is covered at both ends. Subclasses summarize the samples in :meth:result.
Source code in src/guidellm/collectors/collector.py
__init__(kind, interval)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind | str | The kind this collector was configured with | required |
interval | float | Seconds between samples while a benchmark runs | required |
Source code in src/guidellm/collectors/collector.py
reset() abstractmethod async
sample() abstractmethod async
start() async
Reset, sample once, then sample every interval.
stop() async
Stop the periodic samples and take a final sample.