Uploaded image for project: 'In-Portal CMS'
  1. In-Portal CMS
  2. INP-1569

Create System Log record, when stale semaphore is discovered or hit

    XMLWordPrintable

    Details

    • Type: Feature Request
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 5.2.2-B3
    • Component/s: Database
    • Labels:
      None
    • Change Log Group:
      Added
    • Change Log Message:
      A record is created in System Log, when stale semaphores are discovered or hit by other users.
    • Story Points:
      2
    • Copy Issue Key:
    • Patch Instructions:

      Patches must be submitted through Phabricator.

      Description

      1. when somebody hits a semaphore and sees error message log it into "System Log" with "Error" Log Level - 0.5h
      2. add following columns to "Semaphores" table: - 0.5h
        • MainIDs - db type: text; comma-separated list of IDs
        • UserId - db type: int
        • IpAddress - db type: varchar(15)
        • Hostname - db type: varchar(255)
        • LogRequestURI - db type: varchar(255)
        • Backtrace - db type: longtext;
      3. add following setting in the "System Settings" sub-section in the "Configuration > Website > Advanced" section: - 0.5h
        • name: "SemaphoreLifetime"
        • title: "Semaphore Inactivity Timeout (seconds)"
        • default: 300 (means 5 minutes)
      4. create "adm:OnDeleteStaleSemaphores" event, that will: - 1.5h
        • get records from "Semaphores" table, where "Semaphores.Timestamp + {SemaphoreLifetime}

          > UNIX_TIMESTAMP()"

        • if none found, then exit
        • for each found record:
          • create record in "SystemLog" table (using "$this->Application->log" method) where:
            • the "setLogField" method will be used to replace "LogHostname", "LogRequestSource", "LogRequestURI", "LogUserId", "IpAddress" and "LogSessionKey" field values with one, that Semaphore has
            • the "addTrace" method will be used to add trace from semaphore
            • the "setUserData" method will be used to store: value of "MainIDs" field, semaphore creation time, semaphore removal time
            • "Log Level" would be "error"
            • "Message" would be "Stale semaphore discovered"
            • goal is to make that record look like it was created along with semaphore creation
          • delete semaphore record
        • turn "adm:OnDeleteStaleSemaphores" event into a scheduled task, that will run each 5 minutes - 0.5h

      Quote: 3.5h*1.4=5h

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                alex Alex
                Reporter:
                alex Alex
                Developer:
                Alex
                Reviewer:
                Erik Snarski [Intechnic]
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 4h 53m
                  4h 53m