diff --git a/README.md b/README.md index a3c2b5c..9d170b3 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,13 @@ $ ansible-playbook ansible_playbook.yaml --tags config `android_sensor_magnetic_field_tesla{axis}` - Data from the magnetic field sensor in base units `android_sensor_gravity_acceleration` - Data from gravity acceleration sensor, in m/s^2 units `android_sensor_linear_acceleration` - Data from the Android linear acceleration sensor in m/s^2 units. - +`android_sensor_pressure_pascal` - Data from the Android pressure in pascals +`android_sensor_ambient_light_lux` - Data from Android ambient light sensor in lux +`android_sensor_gyroscope_radians_per_second_squared` - Data from Android gyroscope in radians/second^2 +`android_sensor_ambient_temperature_celsius` - Ambient temperature in celsius +`android_sensor_rotation_vector` - Data from the Android Rotation Vector sensor, how is the device rotated, without a unit +`android_sensor_rotation_vector_cosinus_theta_half` - Data from the Android Rotation Vector sensor, how is the device rotated, without a unit +`android_sensor_rotation_vector_accuracy_radians` - Android rotation vector sensor accuracy in radians ### Miscellaneous diff --git a/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/AndroidCustomExporter.kt b/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/AndroidCustomExporter.kt index 7c4a131..ed257cc 100644 --- a/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/AndroidCustomExporter.kt +++ b/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/AndroidCustomExporter.kt @@ -199,6 +199,96 @@ class AndroidCustomExporter(private val metricEngine: MetricsEngine) : Collector addAxisSpecificGauge(gauge, it) mfs.add(gauge) } + + metricEngine.hwSensorsValues().pressureHectoPascal?.let { + val gauge = GaugeMetricFamily( + "android_sensor_pressure_pascal", + "Data from the Android pressure in pascals", + listOf(), + ) + gauge.addMetric(listOf(), it * 100.0) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().ambientLightLux?.let { + val gauge = GaugeMetricFamily( + "android_sensor_ambient_light_lux", + "Data from Android ambient light sensor in lux", + listOf(), + ) + gauge.addMetric(listOf(), it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().gyroscopeRadiansPerSecond?.let { + val gauge = GaugeMetricFamily( + "android_sensor_gyroscope_radians_per_second_squared", + "Data from Android gyroscope in radians/second^2", + listOf("axis"), + ) + addAxisSpecificGauge(gauge, it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().ambientTemperatureCelsius?.let { + val gauge = GaugeMetricFamily( + "android_sensor_ambient_temperature_celsius", + "Data from Android temperature sensor", + listOf(), + ) + gauge.addMetric(listOf(), it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().relativeHumidityPercent?.let { + val gauge = GaugeMetricFamily( + "android_sensor_relative_humidity_ratio", + "Android relative humidity sensor data", + listOf(), + ) + gauge.addMetric(listOf(), it / 100.0) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().offbodyDetect?.let { + val gauge = GaugeMetricFamily( + "android_sensor_offbody_detect", + "Whether the Android device is off the body", + listOf(), + ) + gauge.addMetric(listOf(), it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().rotationVectorValues?.let { + val gauge = GaugeMetricFamily( + "android_sensor_rotation_vector", + "Data from the Android Rotation Vector sensor, how is the device rotated, without a unit", + listOf("axis"), + ) + addAxisSpecificGauge(gauge, it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().rotationVectorCosinusThetaHalf?.let { + val gauge = GaugeMetricFamily( + "android_sensor_rotation_vector_cosinus_theta_half", + "Data from the Android Rotation Vector sensor, how is the device rotated, without a unit", + listOf(), + ) + gauge.addMetric(listOf(),it) + mfs.add(gauge) + } + + metricEngine.hwSensorsValues().rotationVectorAccuracyRadians?.let { + val gauge = GaugeMetricFamily( + "android_sensor_rotation_vector_accuracy_radians", + "Accuracy of the Android rotation vector sensor, in radians", + listOf(), + ) + gauge.addMetric(listOf(),it) + mfs.add(gauge) + } } private fun collectScrapeDuration(mfs : MutableList, startTime : Long){ diff --git a/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/MetricsEngine.kt b/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/MetricsEngine.kt index c22bc41..51e1a04 100644 --- a/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/MetricsEngine.kt +++ b/client/app/src/main/java/com/birdthedeveloper/prometheus/android/exporter/worker/MetricsEngine.kt @@ -27,30 +27,28 @@ data class AxisSpecificGauge( ) class HwSensorsCache( - var headingDegrees : Double? = null, //DONE - var headingAccuracyDegrees : Double? = null, //DONE - var hingeAngleDegrees : Double? = null, //DONE + var headingDegrees : Double? = null, + var headingAccuracyDegrees : Double? = null, + var hingeAngleDegrees : Double? = null, var offbodyDetect : Double? = null, var ambientTemperatureCelsius : Double? = null, var relativeHumidityPercent : Double? = null, - var accelerometer : AxisSpecificGauge? = null, //DONE - var magneticFieldMicroTesla : AxisSpecificGauge? = null, //DONE + var accelerometer : AxisSpecificGauge? = null, + var magneticFieldMicroTesla : AxisSpecificGauge? = null, var gyroscopeRadiansPerSecond: AxisSpecificGauge? = null, var ambientLightLux : Double? = null, var pressureHectoPascal : Double? = null, - var proximityCentimeters : Double? = null, //DONE + var proximityCentimeters : Double? = null, - var gravityAcceleration : AxisSpecificGauge? = null, //DONE + var gravityAcceleration : AxisSpecificGauge? = null, var linearAcceleration : AxisSpecificGauge? = null, var rotationVectorValues : AxisSpecificGauge? = null, var rotationVectorCosinusThetaHalf : Double? = null, var rotationVectorAccuracyRadians : Double? = null, ); -//TODO for cpu, use HardwarePropertiesManager - private val supportedSensors : List = listOf( Sensor.TYPE_HEADING, Sensor.TYPE_HINGE_ANGLE,