Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

feat(api): add eventlog listing #8381

Merged
merged 40 commits into from
Mar 6, 2020

Conversation

victorvassilev
Copy link
Contributor

Description

Add endpoint to allow retrieving event timeline for hosts and services

Fixes # MON-4866,MON-4867

Type of change

  • Patch fixing an issue (non-breaking change)
  • New functionality (non-breaking change)
  • Breaking change (patch or feature) that might cause side effects breaking part of the Software
  • Updating documentation (missing information, typo...)

Target serie

  • 2.8.x
  • 18.10.x
  • 19.04.x
  • 19.10.x
  • 20.04.x (master)

How this pull request can be tested ?

Visit the endpoint using GET:

http://host/centreon/api/beta/monitoring/hosts/14/services/19/timeline
http://host/centreon/api/beta/monitoring/hosts/14/timeline

Checklist

Community contributors & Centreon team

  • I followed the coding style guidelines provided by Centreon
  • I have commented my code, especially new classes, functions or any legacy code modified. (docblock)
  • I have commented my code, especially hard-to-understand areas of the PR.
  • I have made corresponding changes to the documentation.
  • I have rebased my development branch on the base branch (master, maintenance).

Centreon team only

  • I have made sure that the unit tests related to the story are successful.
  • I have made sure that unit tests cover 80% of the code written for the story.
  • I have made sure that acceptance tests related to the story are successful (local and CI)

@victorvassilev victorvassilev requested review from vhr, kduret and callapa and removed request for vhr February 28, 2020 15:04
@victorvassilev victorvassilev changed the base branch from master to MON-4789-unified-view February 28, 2020 15:12
@cgagnaire cgagnaire added area/api kind/feature pr/internal-rd PR made by the Centreon R&D Team labels Mar 4, 2020
* fix(code): dedicated meta event console does not exist anymore

* fix(code): scheduling queue console does not exist anymore

* fix(code): merge some cases

Co-authored-by: Colin Gagnaire <cgagnaire@centreon.com>
@kduret kduret changed the title Mon 4866 add eventlog listing feat(api): add eventlog listing Mar 5, 2020
protected function generateCommentsQuery(StatementCollector $collector, int $hostId, int $serviceId = null): string
{
$sql = "SELECT
CONCAT('C', c.comment_id) AS `eventId`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMHO, eventId should be an integer from only eventId
The unique id will be the association between eventType and eventId

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this way it wouldn't be unique :) we just needed 1 field that is unique for every timeline set of data

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can do a unique identifier based on two fields
For instance, if we want to get information of a specific event, the controller will look like:
monitoring/events/{type}/{id}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with you, but this 'eventId' property does not need to be used if FE don't need it, and can be removed later if we decide it is useless. For now it does not hurt to have it, because I believe every listing endpoint had to have unique identifier for each row of returned info (due to FE requirements). If that is not the case I can always just omit it from the return of the endpoint. It does not create extra load, it does not mess with any business logic, so in a future refactor we can just remove it easily.

victorvassilev and others added 3 commits March 6, 2020 10:50
Co-Authored-By: Kevin Duret <kduret@centreon.com>
…terface.php

Co-Authored-By: Kevin Duret <kduret@centreon.com>
….php

Co-Authored-By: Kevin Duret <kduret@centreon.com>
@victorvassilev victorvassilev requested a review from kduret March 6, 2020 08:53
@victorvassilev victorvassilev merged commit 2467ebd into MON-4789-unified-view Mar 6, 2020
@victorvassilev victorvassilev deleted the MON-4866-add-eventlog-listing branch March 6, 2020 12:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/api kind/feature pr/internal-rd PR made by the Centreon R&D Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants