ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilGlobalCacheMetricsCollectedObjective Class Reference
+ Inheritance diagram for ilGlobalCacheMetricsCollectedObjective:
+ Collaboration diagram for ilGlobalCacheMetricsCollectedObjective:

Protected Member Functions

 getTentativePreconditions (Environment $environment)
 
 collectFrom (Environment $environment, Storage $storage)
 
- Protected Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 collectFrom (Setup\Environment $environment, Storage $storage)
 Attempt to gather metrics based on the provided environment. More...
 
 getTentativePreconditions (Setup\Environment $environment)
 Give preconditions that might or might not be fullfilled. More...
 

Additional Inherited Members

- Public Member Functions inherited from ILIAS\Setup\Metrics\CollectedObjective
 __construct (Storage $storage)
 
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Setup\Environment $environment)
 
 achieve (Setup\Environment $environment)
 
 isApplicable (Setup\Environment $environment)
 
- Public Member Functions inherited from ILIAS\Setup\Objective
 getHash ()
 Get a hash for this objective. More...
 
 getLabel ()
 Get a label that describes this objective. More...
 
 isNotable ()
 Get to know if this is an interesting objective for a human. More...
 
 getPreconditions (Environment $environment)
 Objectives might depend on other objectives. More...
 
 achieve (Environment $environment)
 Objectives can be achieved. More...
 
 isApplicable (Environment $environment)
 Get to know whether the objective is applicable. More...
 
- Protected Attributes inherited from ILIAS\Setup\Metrics\CollectedObjective
Storage $storage
 

Detailed Description

Member Function Documentation

◆ collectFrom()

ilGlobalCacheMetricsCollectedObjective::collectFrom ( Environment  $environment,
Storage  $storage 
)
protected

Definition at line 35 of file class.ilGlobalCacheMetricsCollectedObjective.php.

35 : void
36 {
37 $db = $environment->getResource(Environment::RESOURCE_DATABASE);
38 $client_ini = $environment->getResource(Environment::RESOURCE_CLIENT_INI);
39
40 if (!$client_ini) {
41 return;
42 }
43
44 $config = (new ilGlobalCacheSettingsAdapter($client_ini, $db))->getConfig();
45
46 $service = $config->getAdaptorName();
48 "service",
50 "The backend that is used for the ILIAS cache."
51 );
53 "active",
54 $config->isActivated()
55 );
56
57 $servers = $config->getNodes();
58 if (
59 $service === Config::MEMCACHED &&
60 $servers !== []
61 ) {
62 $server_collection = [];
63 foreach ($servers as $server) {
64 $host = new Metric(
65 Metric::STABILITY_CONFIG,
66 Metric::TYPE_TEXT,
67 $server->getHost()
68 );
69 $port = new Metric(
70 Metric::STABILITY_CONFIG,
71 Metric::TYPE_GAUGE,
72 $server->getPort()
73 );
74 $weight = new Metric(
75 Metric::STABILITY_CONFIG,
76 Metric::TYPE_GAUGE,
77 $server->getWeight()
78 );
79
80 $server_collection[] = new Metric(
81 Metric::STABILITY_CONFIG,
82 Metric::TYPE_COLLECTION,
83 [
84 "host" => $host,
85 "port" => $port,
86 "weight" => $weight
87 ],
88 "Configured memcached node."
89 );
90 }
91
92 $nodes = new Metric(
93 Metric::STABILITY_CONFIG,
94 Metric::TYPE_COLLECTION,
95 $server_collection,
96 "Collection of configured memcached nodes."
97 );
98 $storage->store("memcached_nodes", $nodes);
99 }
100
101 $component_activation = [];
102 foreach (ilGlobalCache::getAvailableComponents() as $component) {
103 $component_activation[$component] = new Metric(
104 Metric::STABILITY_CONFIG,
105 Metric::TYPE_BOOL,
106 $config->isComponentActivated($component)
107 );
108 }
109 $component_activation = new Metric(
110 Metric::STABILITY_CONFIG,
111 Metric::TYPE_COLLECTION,
112 $component_activation,
113 "Which components are activated to use caching?"
114 );
116 "components",
117 $component_activation
118 );
119 }
A metric is something we can measure about the system.
Definition: Metric.php:34
getResource(string $id)
Consumers of this method should check if the result is what they expect, e.g.
store(string $key, Metric $metric)
Store some metric in the storage.
storeConfigText(string $key, string $value, ?string $description=null)
storeConfigBool(string $key, bool $value, ?string $description=null)
$service
Definition: ltiresult.php:36
$server
Definition: shib_login.php:28

References $server, $service, ILIAS\Setup\Metrics\CollectedObjective\$storage, ILIAS\Setup\Environment\getResource(), ILIAS\Setup\Metrics\Storage\store(), ILIAS\Setup\Metrics\Storage\storeConfigBool(), and ILIAS\Setup\Metrics\Storage\storeConfigText().

+ Here is the call graph for this function:

◆ getTentativePreconditions()

ilGlobalCacheMetricsCollectedObjective::getTentativePreconditions ( Environment  $environment)
protected

Definition at line 27 of file class.ilGlobalCacheMetricsCollectedObjective.php.

27 : array
28 {
29 return [
31 new \ilDatabaseInitializedObjective()
32 ];
33 }

The documentation for this class was generated from the following file: