collect method
collect all metrics and samples that are part of this Collector.
Implementation
@override
Future<Iterable<MetricFamilySamples>> collect() async {
return [
MetricFamilySamples('dart_info', MetricType.gauge,
'Information about the Dart environment.', [
Sample('dart_info', const ['version'], [Platform.version], 1)
]),
// TODO: Metrics about gc & co would be nice runtime metrics but are
// unavailable in the Dart VM.
// TODO: We can only support a limited set of process metrics, as Dart
// doesn't expose more of them.
MetricFamilySamples('process_resident_memory_bytes', MetricType.gauge,
'Resident memory size in bytes.', [
Sample('process_resident_memory_bytes', const [], const [],
ProcessInfo.currentRss.toDouble())
]),
MetricFamilySamples('process_start_time_seconds', MetricType.gauge,
'Start time of the process since unix epoch in seconds.', [
Sample('process_start_time_seconds', const [], const [],
_startupTime.toDouble())
]),
];
}