o11y-8.x-1.x-dev/modules/o11y_metrics/o11y_metrics.module
modules/o11y_metrics/o11y_metrics.module
<?php
/**
* @file
* This is the Prometheus Exporter module for exporting metrics.
*/
use Drupal\o11y_metrics_cache\Cache\CacheMetricsCacheTagsInvalidator;
/**
* Implements hook_modules_uninstalled().
*
* Removes config for any sub-modules that provide plugins.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function o11y_metrics_modules_uninstalled($modules, $is_syncing) {
// Here we do some additional cleanup for tag metrics since it has some race
// conditions with core during module uninstall.
if (in_array('o11y_metrics_cache', $modules)) {
$promBridge = \Drupal::service('o11y_metrics.prometheus_bridge');
$promBridge->removeMetricsOfSource(CacheMetricsCacheTagsInvalidator::class);
}
if (!$is_syncing) {
/** @var \Drupal\o11y_metrics\MetricsCollectorManagerInterface $collector_manager */
$collector_manager = \Drupal::service('o11y_metrics.metrics_collector_manager');
$collector_manager->syncPluginConfig();
}
}
/**
* Implements hook_modules_installed().
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
function o11y_metrics_modules_installed($modules, $is_syncing) {
if (!$is_syncing) {
/** @var \Drupal\o11y_metrics\MetricsCollectorManagerInterface $collector_manager */
$collector_manager = \Drupal::service('o11y_metrics.metrics_collector_manager');
$collector_manager->syncPluginConfig();
}
}
