-
The WMArchive performance data is exposed by the
/data/performance
endpoint, e.g.:https://cmsweb.cern.ch/wmarchive/data/performance?metrics[]=jobstate&axes[]=host
or on the test deployment:
https://cmsweb-testbed.cern.ch/wmarchive/data/performance?metrics[]=jobstate&axes[]=host
-
Requests to this endpoint can include the following query arguments:
- A list of
metrics
where each is a dot-separated key path into theperformance
dictionary in the performance data structure, orjobstate
ordata.events
. - A list of
axes
where each is a key in thescope
dictionary in the performance data structure. - A
start_date
andend_date
formatted asYYYYMMDD
that give the timeframe of the requested data. - Any number of scope filters as key-value pairs where the key follows the same requirements as
axes
and the value is a valid regular expression. - A list of
suggestions
with the same requirements asaxes
.
- A list of
-
The resulting payload is of the following structure:
{ "result": [ { "performance": { ... } } ] }
The
performance
dictionary then contains the requested data in the following keys:status
:time
is the processing time of the aggregationtotalMatchedJobs
is the number of jobs matched by the given scope filters and timeframestart_date
andend_date
give the bounds of all matched job timestampsmax_date
andmin_date
give the bounds of all job timestamps available in the database
visualizations
is a nested dictionary that contains the aggregated data for each metric and axis given inmetrics
andaxes
. The data is a list of objects, each with alabel
corresponding to their axis value. For thejobstate
metric they include a list ofjobstates
each with acount
andjobstate
, whereas for other metrics they include the aggregatedaverage
value as well as thecount
of jobs that were aggregated over.
This data is intended to be visualized using a framework such as D3.js or Chart.js.
suggestions
gives all distinct values in the database for each scope key given in thesuggestions
query argument list. It takes into account all scope filters and timeframe given in the query, except for the one the distinct values are collected for.
This list is intended to serve as scope filter input suggestions.
- Finally,
supplementaryData
contextually provides additional data. In particular it includes the complete dictionary ofexitCodes
descriptions ifexitCode
is requested either inaxes
orsuggestions
, and the complete set ofmetrics
if none was requested.
The
exitCodes
dictionary is intended to provide human-readable descriptions for exit codes and is discussed in Report 009.The
metrics
dictionary is intended to provide the display and formatting information for each metric and is discussed in Report 011.
- As of the configuration in
WMArchive/etc
for theWMCore
server backend the REST API is served from the/data
endpoint given byWMArchive.Service.Data.WMAData
. - The
WMAData
class parses the request arguments. I kept the changes to a minimum by only adding the/data/performance
endpoint. However, I suggest to improve the remainder of the REST API that I assume is not yet entirely conceptualized, to follow a more consistent structure. Functionality parallel to/data/performance
should be exposed as distinct endpoints such as/data/status
or even/status
instead of query arguments. - The
/data/performance
endpoint's query arguments are processed inWMAData.validate
. Additional arguments such as scope filters must be added here along with their valid regular expression pattern. - Valid requests then return the result of
WMAData.get
. I also only added the/data/performance
endpoint here without changes to the general result data structure. I suggest to remove the complexity introduced by returning a list of dictionaries here and instead move the responsibility of defining their result data structure to the individual endpoints. For example the/data/performance
endpoint would ideally just returnresult[0].performance
directly. - Note that query arguments that take a list appear in the request URL as multiple occurences of the argument name suffixed with
[]
such asmetrics[]
. They are validated byvalidate_strlist
inWMAData.validate
with this suffix, but it must be removed inWMAData.get
before passing it to Python functions as arguments. - The responsibility of retrieving the return data lies within
WMAData
'sWMArchiveManager
. Through a chain of calls to aperformance
function, this responsiblity is passed throughWMArchive.Service.Manager.WMArchiveManager
overWMArchive.Service.STS.STSManager
toWMArchive.Storage.MongoIO.MongoStorage
. - The
MongoStorage.performance
function implements the filtering and aggregation logic to collect the requested data from MongoDB.- The MongoDB database and collection to use are read from the environment variables
WMARCHIVE_PERF_DB
andWMARCHIVE_PERF_COLL
and default toaggregated.performance
. - The procedure is based on MongoDB's aggregation pipeline.
- If requested, also
exitCodes
and the complete set ofmetrics
is read from theWMARCHIVE_ERROR_CODES
andWMARCHIVE_PERF_METRICS
environment variables. Particularly the latter must be set to provide the UI with information on the metrics to present and is discussed in Report 011.
- The MongoDB database and collection to use are read from the environment variables