func addFileSystemMetrics[T number]()

in remappers/hostmetrics/filesystem.go [108:138]


func addFileSystemMetrics[T number](out pmetric.MetricSlice,
	timestamp pcommon.Timestamp,
	mutator func(pmetric.NumberDataPoint),
	name, device, mpoint, fstype string,
	value T,
) {
	var intValue *int64
	var doubleValue *float64
	if i, ok := any(value).(int64); ok {
		intValue = &i
	} else if d, ok := any(value).(float64); ok {
		doubleValue = &d
	}

	remappedmetric.Add(out, remappedmetric.ChainedMutator(
		mutator,
		func(dp pmetric.NumberDataPoint) {
			dp.Attributes().PutStr("system.filesystem.device_name", device)
			dp.Attributes().PutStr("system.filesystem.mount_point", mpoint)
			dp.Attributes().PutStr("system.filesystem.type", fstype)
		}),
		remappedmetric.Metric{
			DataType:    pmetric.MetricTypeSum,
			Name:        name,
			Timestamp:   timestamp,
			IntValue:    intValue,
			DoubleValue: doubleValue,
		},
	)

}