|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Jabe\Engine\Impl\Metrics\Util; |
|
4
|
|
|
|
|
5
|
|
|
use Jabe\Engine\Management\Metrics; |
|
6
|
|
|
|
|
7
|
|
|
class MetricsUtil |
|
8
|
|
|
{ |
|
9
|
|
|
/** |
|
10
|
|
|
* Resolves the internal name of the metric by the public name. |
|
11
|
|
|
* |
|
12
|
|
|
* @param publicName the public name |
|
13
|
|
|
* @return string the internal name |
|
14
|
|
|
*/ |
|
15
|
|
|
public static function resolveInternalName(?string $publicName): ?string |
|
16
|
|
|
{ |
|
17
|
|
|
if ($publicName == null) { |
|
|
|
|
|
|
18
|
|
|
return null; |
|
19
|
|
|
} |
|
20
|
|
|
switch ($publicName) { |
|
21
|
|
|
case Metrics::TASK_USERS: |
|
|
|
|
|
|
22
|
|
|
return Metrics::UNIQUE_TASK_WORKERS; |
|
23
|
|
|
case Metrics::PROCESS_INSTANCES: |
|
|
|
|
|
|
24
|
|
|
return Metrics::ROOT_PROCESS_INSTANCE_START; |
|
25
|
|
|
//case Metrics::DECISION_INSTANCES: |
|
26
|
|
|
// return Metrics::EXECUTED_DECISION_INSTANCES; |
|
27
|
|
|
case Metrics::FLOW_NODE_INSTANCES: |
|
|
|
|
|
|
28
|
|
|
return Metrics::ACTIVTY_INSTANCE_START; |
|
29
|
|
|
default: |
|
30
|
|
|
return $publicName; |
|
31
|
|
|
} |
|
32
|
|
|
} |
|
33
|
|
|
|
|
34
|
|
|
/** |
|
35
|
|
|
* Resolves the public name of the metric by the internal name. |
|
36
|
|
|
* |
|
37
|
|
|
* @param internalName the internal name |
|
38
|
|
|
* @return string the public name |
|
39
|
|
|
*/ |
|
40
|
|
|
public static function resolvePublicName(?string $internalName): ?string |
|
41
|
|
|
{ |
|
42
|
|
|
if ($internalName == null) { |
|
|
|
|
|
|
43
|
|
|
return null; |
|
44
|
|
|
} |
|
45
|
|
|
switch ($internalName) { |
|
46
|
|
|
case Metrics::UNIQUE_TASK_WORKERS: |
|
47
|
|
|
return Metrics::TASK_USERS; |
|
|
|
|
|
|
48
|
|
|
case Metrics::ROOT_PROCESS_INSTANCE_START: |
|
49
|
|
|
return Metrics::PROCESS_INSTANCES; |
|
|
|
|
|
|
50
|
|
|
//case Metrics::EXECUTED_DECISION_INSTANCES: |
|
51
|
|
|
// return Metrics::DECISION_INSTANCES; |
|
52
|
|
|
case Metrics::ACTIVTY_INSTANCE_START: |
|
53
|
|
|
return Metrics::FLOW_NODE_INSTANCES; |
|
|
|
|
|
|
54
|
|
|
default: |
|
55
|
|
|
return $internalName; |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
} |
|
59
|
|
|
|