Skip to content
GitLab
Explorer
Connexion
S'inscrire
Navigation principale
Rechercher ou aller à…
Projet
S
stats-facil
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Environnements
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse CI/CD
Données d'analyse du dépôt
Expériences du modèle
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
facil
stats-facil
Validations
55b8645a
Valider
55b8645a
rédigé
11 years ago
par
diosmosis
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Refs #4200, tweaking ArchiveProcessor docs.
parent
c0ef1c1c
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
1
Masquer les modifications d'espaces
En ligne
Côte à côte
Affichage de
1 fichier modifié
core/ArchiveProcessor.php
+36
-18
36 ajouts, 18 suppressions
core/ArchiveProcessor.php
avec
36 ajouts
et
18 suppressions
core/ArchiveProcessor.php
+
36
−
18
Voir le fichier @
55b8645a
...
...
@@ -20,20 +20,18 @@ use Piwik\Db;
use
Piwik\Period
;
/**
* Used to insert numeric and blob archive data.
* Used to insert numeric and blob archive
data, and to aggregate archive
data.
*
* During the Archiving process a
descendant
of this class is used by plugins
* During the Archiving process a
n instance
of this class is used by plugins
* to cache aggregated analytics statistics.
*
* When the [Archive](#) class is used to query for archive data and that archive
* data is found to be absent, the archiving process is launched. An ArchiveProcessor
* instance is created based on the period type and the archiving logic of every
* active plugin is executed through the [ArchiveProcessor.Day.compute](#) and
* [ArchiveProcessor.aggregateMultipleReports](#) events.
* data is found to be absent, the archiving process is launched. Instances of the
* [Archiver](#) classes for every plugin that supplies one are then used to
* execute archiving logic.
*
* Plugins receive ArchiveProcessor instances in those events and use them to
* aggregate data for the requested site, period and segment. The aggregate
* data is then persisted, again using the ArchiveProcessor instance.
* Plugins access ArchiveProcessor instances through the [Archiver](#) class. Read
* the docs for [Archiver](#) to learn more about the process.
*
* ### Limitations
*
...
...
@@ -53,8 +51,10 @@ use Piwik\Period;
* **Inserting numeric data**
*
* // function in an Archiver descendent
* public function aggregateDayReport(
ArchiveProcessor $archiveProcessor
)
* public function aggregateDayReport()
* {
* $archiveProcessor = $this->getProcessor();
*
* $myFancyMetric = // ... calculate the metric value ...
* $archiveProcessor->insertNumericRecord('MyPlugin_myFancyMetric', $myFancyMetric);
* }
...
...
@@ -62,8 +62,10 @@ use Piwik\Period;
* **Inserting serialized DataTables**
*
* // function in an Archiver descendent
* public function aggregateDayReport(
ArchiveProcessor $archiveProcessor
)
* public function aggregateDayReport()
* {
* $archiveProcessor = $this->getProcessor();
*
* $maxRowsInTable = Config::getInstance()->General['datatable_archiving_maximum_rows_standard'];j
*
* $myDataTable = // ... use LogAggregator to generate a report about some log data ...
...
...
@@ -75,6 +77,21 @@ use Piwik\Period;
* $archiveProcessor->insertBlobRecords('MyPlugin_myFancyReport', $serializedData);
* }
*
* **Aggregating archive data**
*
* // function in Archiver descendent
* public function aggregateMultipleReports()
* {
* $archiveProcessor = $this->getProcessor();
*
* // aggregate a metric
* $archiveProcessor->aggregateNumericMetrics('MyPlugin_myFancyMetric');
* $archiveProcessor->aggregateNumericMetrics('MyPlugin_mySuperFancyMetric', 'max');
*
* // aggregate a report
* $archiveProcessor->aggregateDataTableRecords('MyPlugin_myFancyReport');
* }
*
* @package Piwik
* @subpackage ArchiveProcessor
*/
...
...
@@ -120,7 +137,7 @@ class ArchiveProcessor
}
/**
* Returns the Parameters object containing
Period, Site, S
egment used
for
this archive.
* Returns the Parameters object containing
the site, period and s
egment used
with
this archive.
*
* @return Parameters
* @api
...
...
@@ -175,6 +192,7 @@ class ArchiveProcessor
* ...
* )
* ```
* @api
*/
public
function
aggregateDataTableRecords
(
$recordNames
,
$maximumRowsInDataTableLevelZero
=
null
,
...
...
@@ -205,8 +223,8 @@ class ArchiveProcessor
}
/**
* Aggregates metrics for every subperiod of the current period and inserts the result
* as
the
metric for th
is
period.
* Aggregates
one or more
metrics for every subperiod of the current period and inserts the result
s
* as metric
s
for th
e current
period.
*
* @param array|string $columns Array of metric names to aggregate.
* @param bool|string $operationToApply The operation to apply to the metric. Either `'sum'`, `'max'` or `'min'`.
...
...
@@ -219,7 +237,9 @@ class ArchiveProcessor
* 'nb_hits' => 405
* )
* ```
* is returned.
* could be returned. If `array('nb_visits')` or `'nb_visits'` is used for `$columns`,
* then `3040` would be returned.
* @api
*/
public
function
aggregateNumericMetrics
(
$columns
,
$operationToApply
=
false
)
{
...
...
@@ -452,6 +472,4 @@ class ArchiveProcessor
$data
=
$query
->
fetch
();
return
$data
[
Metrics
::
INDEX_NB_UNIQ_VISITORS
];
}
}
}
\ No newline at end of file
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter