class Ens.SAM.SensorSampler
extends %RegisteredObject
property ForceSAMEnabled
as %Boolean [ InitialExpression = 0 ];
The code checks if SAM recording is enabled for the Interoperability SAM
Set this to 1 to force SAM recording even if SAM recording is not enabled for the Interoperability SAM
property HostTypeMap
as %String [ MultiDimensional ];
Map used to translate host types
property IncludeHostLabel
as %Boolean [ InitialExpression = $$$SAMInteropIncludeHostLabelGet ];
Flag to indicate if include host name as data for Business Host label
Busines Host label is defined as $$$EnsSAMHostLabel "host"
Used in conjunction with sensorLabels that are defined in the definition.Br>
Defaults to true.
property IncludeProductionLabel
as %Boolean [ InitialExpression = $$$SAMInteropIncludeProdLabelGet ];
Flag to indicate if include production name as data for label 'production'
Used in conjunction with sensorLabels that are defined in the definition.Br>
Defaults to true
property LastSAMSensorCalculatedReadings
as %String [ MultiDimensional ];
Storage for Sensor data Calculated during one sample from last
sample recording to aid pruning
property LastSAMSensorReadings
as %String [ MultiDimensional ];
Storage for Sensor data from last sample recording
to aid pruning
property RegisteredLabels
as %String [ MultiDimensional ];
Array of labels that can be collected
If empty then all labels requested will be recorded
Array can be populated when initialized using the JSON definition
sensors.sensorLabels array.
property SAMProductionLabel
as %String [ InitialExpression = $ListBuild($$$EnsSAMProductionLabel,$Get($$$EnsRuntime("Name"))) ];
Label 'production' equal to name of current running production
property SAMSensorCalculatedReadings
as %String [ MultiDimensional ];
Storage for Sensor data Calculated during one sample
property SAMSensorReadings
as %String [ MultiDimensional ];
Storage for Sensor data during one sample
property SAMSensors
as %String [ MultiDimensional ];
Array of Sensor names this instance will sample
Sensor names are Camel Case
Sensor types: Counter, Gauge, Histogram, Summary.
Which Counter types ought to calculate per sec
Counter, CounterWithPerSec, Gauge, Histogram, Summary
property lastPerSecSensorReadings
as %String [ MultiDimensional ];
Storage for last Sample data needed to calculate per second
property lastSamplePointInTime
as %Numeric [ InitialExpression = $ZH ];
Internal $ZH for calculating time since last sample
method CollectOneSensorSample(pSensorName As %String, pSensorData, ByRef pLabels As %String = "")
pLabels is an optional comma separate list of label=value or
an array where label name is the key.
This method always add namespace as the id label.
method CompleteSensorSample(pOverrideElapsedTime As %Integer)
Pass in the Elapsed Time used to calculate average per second
to override elapsed time calculated since last sample.
method CurrentSampleDuration()
as %Numeric
This returns how many seconds since the last sample was recorded
or the sampling was started if a recording has not taken place.
method RecordSensorSamples()
classmethod RemoveAllRecordedSensorSample()
This method can be used during development to remove all
centrally recorded Interoperability Sensor data for this namespace.
This is to help where Sensor names change.
method RemoveLastRecordedSensorSample(pOnlyLastInstanceSample As %Boolean = 0)
If collecting SAM data then remove last sample.
If the code using this calls might not be running when the Production is running it is
is necessary to call this when exiting , for example during OnTearDown().
The parameter pOnlyLastInstanceSample is set to true when recording current values
to ensure prior data is pruned.
method SamplesCollectedForSensor(pSensorName As %String)
as %Integer
Number of times CollectOneSensorSample has been called
for pSensorName
method SetSensors(ByRef pSensors)
Takes sensors definition (either as an array or object)
and populate instance data.
method StartSensorSample()
Clean up last sample of data
method initSensorsFromArray(ByRef pSensors)
method initSensorsFromObject(pSensors As %DynamicArray)