Lai,Risheng
2023-11-02 30c02e0c981b16be0918483543f4b812956c45d4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
Quintiq file version 2.0
#parent: #root
StaticMethod LogSnapshot (const KpiSnapshotData snapshotData)
{
  Description:
  [*
    CAN EXTEND | Logs the kpis to a standard logger. Extend if you want to disable the logging or change the way it is logged (e.g. add additional label slots).
    Note - this format is used by the Delmia Hosted Services monitoring solution - it is not recommended to change the logging format if you plan on utilizing the monitoring solution.
  *]
  TextBody:
  [*
    // Note - this format is used by the Delmia Hosted Services monitoring solution - it is not recommended to change the logging format if you plan on utilizing the monitoring solution.
    
    logkpis := guard( SettingsEngine::SettingsEngine().SettingsHolder().SettingEntryBooleanValue( "kpitracker.logkpis" ), false );
    if( logkpis )
    {
      na          := Translations::Kpi_Logger_NA();
      labels      := selectsortedset( snapshotData, Label, l, true, l.Name() );
      labelNames  := selectvalues( labels, Elements, l, true, l.Name() );
      labelValues := selectvalues( labels, Elements, l, true, l.Value() );
      kpis        := selectsortedset( snapshotData, Value, kpi, true, kpi.Name() );
      
      traverse( kpis, Elements, kpi )
      {
        LoggerKpiSnapshot::Info( snapshotData.PlanDateTime(),
                                 kpi.Name(),
                                 kpi.Value(),
                                 guard( labelNames.Element( 0 ), na ),
                                 guard( labelValues.Element( 0 ), na ),
                                 guard( labelNames.Element( 1 ), na ),
                                 guard( labelValues.Element( 1 ), na ),
                                 guard( labelNames.Element( 2 ), na ),
                                 guard( labelValues.Element( 2 ), na ),
                                 guard( labelNames.Element( 3 ), na ),
                                 guard( labelValues.Element( 3 ), na ),
                                 guard( labelNames.Element( 4 ), na ),
                                 guard( labelValues.Element( 4 ), na ),
                                 '' );
      }
    }
  *]
  InterfaceProperties { Accessibility: 'Extensible' }
}