-
Notifications
You must be signed in to change notification settings - Fork 22
[O2B-1592] Add infologger listeners middleware to overview page endpoints #2160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
graduta
merged 44 commits into
main
from
improv/O2B-1592/add-infologger-listeners-middleware-to-overview-page-endpoints
Jun 12, 2026
Merged
Changes from 40 commits
Commits
Show all changes
44 commits
Select commit
Hold shift + click to select a range
9d6f065
feat: add setFilterFromURL function to filteringModel
f6a0212
feat: mundane implementations of setFilterFromURL in OverviewModels
4058609
feat: implement setfilterFromURL for all runsOverview models
e253ed6
test: add tests for urlToFilter
72af509
undo faulty textFilter -> textInputFilter conversion
571ca62
fix eslint issues
4e22d71
feat: create filterLogger
d23795c
feat: add logs to all filterable overview endpoints
192fddd
fix: remove async from setFilterFromURL and improve readability
ceb2ced
chore: remove unneeded variable
ae2acca
chore: fix fillter getter from request
94a9057
chore: initialize FilterLogger with parenthesis
ee0dda9
test: uncomment a test suite
83c28cb
undo a textInputFilter migration
7df8afe
chore: undo filterlogger
7bcf905
feat: use replace history instead of pushHistory in FilteringModel
09483c4
chore: rename documentation to be more consistent with the rest of th…
cc6dc57
feat: reset filters if no filters are present in url
ba1ce7d
add test
9699f37
fix linting issues
7939594
uncomment test suites
a806dde
feat: update setFilterFromURL to receive a notify argument
19ae3f2
only notify once for rundefinitions filter
6b520a6
feat: attempt to fully move filter from url setting to RunModel
781bece
feat: addSetFilterFromURL functions to all overview models
b817c87
feat: call setFilterFromURL fromLogsModel
0401062
feat: move all setFilterFromURL calls entity model files
e88a2de
improve selectionModel normalize setter for allowing a different order
a092efd
textFilterModel migration.
c405d9f
feat: add isInactive getter to FilterModel and SelectionModel
1a3cbe4
feat: implement isInactive for ToggleFilterModel and MultiComposition…
0cc8d6a
feat: allow the stable beams only toggle to be toggled and untoggled …
87a5941
linter fixes
cc21b68
feat: create FilterLogger class
7260c0f
feat: create infoLoggerListener
6ed0a45
feat: add InfoLogger middleware overview page endpoints
2a2686c
feat: configrue winston wrapper to exclude logs when in a testing env…
790164e
chore: use dedicated isInTesMode function rather than manual test check
44c8388
Merge branch 'main' into improv/O2B-1592/add-infologger-listeners-mid…
91e2aef
fix linting issue
79815a2
chore repair filter misspelling again
420762b
fix: add default value for session argument
c17e046
feat: add new message path
4e6d519
Merge branch 'main' into improv/O2B-1592/add-infologger-listeners-mid…
graduta File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
| const { LogManager, LogLevel } = require('@aliceo2/web-ui'); | ||
| const { isInTestMode } = require('../../utilities/env-utils'); | ||
|
|
||
| /** | ||
| * Logger dedicated to filter-related endpoint access events. | ||
| */ | ||
| class FilterLogger { | ||
| /** | ||
| * Creates an instance of FilterLogger. | ||
| */ | ||
| constructor(silent = isInTestMode()) { | ||
| LogManager.configure({ infologger: true }); | ||
| this._logger = LogManager.getLogger('FILTERING'); | ||
| this._logLevel = LogLevel.OPERATIONS; | ||
| this._silent = silent; | ||
| } | ||
|
|
||
| /** | ||
| * Logs an informational message about endpoint access and applied filters. | ||
| * | ||
| * @param {object} request the request received at any given endpoint. | ||
| * @param {string} endpoint the endpoint that was accessed. | ||
| * @param {string|number} id identifier of the user accessing the endpoint. | ||
| * @param {Object} [filters={}] filters applied to the request. | ||
| * @returns {void} | ||
| */ | ||
| infoMessage({ path, session: { id }, query = {} }) { | ||
| if (this._silent) { | ||
| return; | ||
| } | ||
|
|
||
| const filters = query.filters ?? {}; | ||
|
graduta marked this conversation as resolved.
Outdated
|
||
|
|
||
| let message = `Endpoint ${path} was accessed by user ${id} `; | ||
|
|
||
| if (!Object.keys(filters).length) { | ||
| message += 'without filters'; | ||
| } else { | ||
| message += 'with the following filters:\n'; | ||
| message += JSON.stringify(filters); | ||
| } | ||
|
|
||
| this._logger.infoMessage(message, { level: this._logLevel }); | ||
| } | ||
| } | ||
|
|
||
| module.exports = new FilterLogger(); | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| /** | ||
| * @license | ||
| * Copyright CERN and copyright holders of ALICE O2. This software is | ||
| * distributed under the terms of the GNU General Public License v3 (GPL | ||
| * Version 3), copied verbatim in the file "COPYING". | ||
| * | ||
| * See http://alice-o2.web.cern.ch/license for full licensing information. | ||
| * | ||
| * In applying this license CERN does not waive the privileges and immunities | ||
| * granted to it by virtue of its status as an Intergovernmental Organization | ||
| * or submit itself to any jurisdiction. | ||
| */ | ||
|
|
||
| /** | ||
| * Logger based middleware generator | ||
| * | ||
| * @param {Class} logger class that exposes an infoMessage function that recceives the request and then sends specific data to InfoLogger | ||
| * @return {(function(*, *, *): void)} the infoLoggerListener middleware | ||
| */ | ||
| exports.infoLoggerListenerMiddleware = (logger) => (request, _response, next) => { | ||
| logger.infoMessage(request); | ||
| next(); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.