ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
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
 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 36 of file class.ilGlobalCacheMetricsCollectedObjective.php.

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

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

◆ getTentativePreconditions()

ilGlobalCacheMetricsCollectedObjective::getTentativePreconditions ( Environment  $environment)
protected

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

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

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