Skip to content

feat: extract MySQL/MariaDB monitor to its own monitor-type and enable support conditions#6601

Merged
CommanderStorm merged 13 commits intolouislam:masterfrom
eureka0928:feat/issue-6316
Jan 6, 2026
Merged

feat: extract MySQL/MariaDB monitor to its own monitor-type and enable support conditions#6601
CommanderStorm merged 13 commits intolouislam:masterfrom
eureka0928:feat/issue-6316

Conversation

@eureka0928
Copy link
Copy Markdown
Contributor

📝 Summary of changes done and why they are done

  • Extract MySQL/MariaDB monitor from monitor.js to its own monitor-type file (server/monitor-types/mysql.js)
  • Add conditions support with result variable for query result validation
  • Enable monitoring of MariaDB SQL results (replication status, health checks, custom queries)
  • Add tests using MariaDB testcontainer

📋 Related issues

📄 Checklist

Please follow this checklist to avoid unnecessary back and forth (click to expand)
  • ⚠️ If there are Breaking change (a fix or feature that alters existing functionality in a way that could cause issues) I have called them out
  • 🧠 I have disclosed any use of LLMs/AI in this contribution and reviewed all generated content.
    I understand that I am responsible for and able to explain every line of code I submit.
  • 🔍 My code adheres to the style guidelines of this project.
  • ⚠️ My changes generate no new warnings.
  • 🛠️ I have reviewed and tested my code.
  • 📝 I have commented my code, especially in hard-to-understand areas (e.g., using JSDoc for methods).
  • 🤖 I added or updated automated tests where appropriate.
  • 📄 Documentation updates are included (if applicable).
  • 🔒 I have considered potential security impacts and mitigated risks.
  • 🧰 Dependency updates are listed and explained.

📷 Screenshots or Visual Changes

  • UI Modifications: Highlight any changes made to the user interface.
  • Before & After: Include screenshots or comparisons (if applicable).

Contribution by Gittensor, see my contribution statistics at https://gittensor.io/miners/details?githubId=42954461

@eureka0928
Copy link
Copy Markdown
Contributor Author

Hi @CommanderStorm would you review this PR? this was easy as you shared the reference PR and guide

Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

Really nice work, there are two things which I apparently did not notice during the sqlserver PR. Both are super simple to fix.

Could you maybe also fix them for the sqlserver impl since they are both extremely simple to fix

@eureka0928
Copy link
Copy Markdown
Contributor Author

Really nice work, there are two things which I apparently did not notice during the sqlserver PR. Both are super simple to fix.

Could you maybe also fix them for the sqlserver impl since they are both extremely simple to fix

Would you review my update for mysql first? before I move to sqlserver?
Thank you for quick review and guide

Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

a bit of lightly appliable diff, nothing major

@eureka0928
Copy link
Copy Markdown
Contributor Author

@CommanderStorm finally I push the commit for mssql changes, please review again for last commit 😉
We are purging many today

Copy link
Copy Markdown
Collaborator

@CommanderStorm CommanderStorm left a comment

Choose a reason for hiding this comment

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

image

@eureka0928
Copy link
Copy Markdown
Contributor Author

the test fails are the another flakes... still good to merge?

Error: Command failed: npm run test-backend-20
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:891:11)
    at Module.execSync (node:child_process:963:15)
    at file:///home/runner/work/uptime-kuma/uptime-kuma/test/test-backend.mjs:9:18
    at ModuleJob.run (node:internal/modules/esm/module_job:325:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:606:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5) {

@CommanderStorm
Copy link
Copy Markdown
Collaborator

Okay... CI is failing..

But it is in this PRs Tests, so luckily no flake.
I am going to go to bed now, automerge is enabled

    # Subtest: check() rejects when custom query result does not meet condition
    not ok 4 - check() rejects when custom query result does not meet condition
      ---
      duration_ms: 8615.04567
      location: '/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:123:9'
      failureType: 'testCodeFailure'
      error: 'Missing expected rejection (Error).'
      code: 'ERR_ASSERTION'
      name: 'AssertionError'
      expected:
      error: 'Query result did not meet the specified conditions (99)'
      stack: |-
        TestContext.<anonymous> (/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:149:21)
        process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        async Test.run (node:internal/test_runner/test:797:9)
        async Suite.processPendingSubtests (node:internal/test_runner/test:526:7)
      operator: 'rejects'
      stack: |-
        process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        async TestContext.<anonymous> (/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:147:17)
        async Test.run (node:internal/test_runner/test:797:9)
        async Suite.processPendingSubtests (node:internal/test_runner/test:526:7)
      ...
    1..4
not ok 9 - MySQL/MariaDB Monitor

@CommanderStorm CommanderStorm enabled auto-merge (squash) January 6, 2026 07:00
@eureka0928
Copy link
Copy Markdown
Contributor Author

Okay... CI is failing..

But it is in this PRs Tests, so luckily no flake. I am going to go to bed now, automerge is enabled

    # Subtest: check() rejects when custom query result does not meet condition
    not ok 4 - check() rejects when custom query result does not meet condition
      ---
      duration_ms: 8615.04567
      location: '/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:123:9'
      failureType: 'testCodeFailure'
      error: 'Missing expected rejection (Error).'
      code: 'ERR_ASSERTION'
      name: 'AssertionError'
      expected:
      error: 'Query result did not meet the specified conditions (99)'
      stack: |-
        TestContext.<anonymous> (/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:149:21)
        process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        async Test.run (node:internal/test_runner/test:797:9)
        async Suite.processPendingSubtests (node:internal/test_runner/test:526:7)
      operator: 'rejects'
      stack: |-
        process.processTicksAndRejections (node:internal/process/task_queues:95:5)
        async TestContext.<anonymous> (/home/runner/work/uptime-kuma/uptime-kuma/test/backend-test/monitors/test-mysql.js:147:17)
        async Test.run (node:internal/test_runner/test:797:9)
        async Suite.processPendingSubtests (node:internal/test_runner/test:526:7)
      ...
    1..4
not ok 9 - MySQL/MariaDB Monitor

Thank you, good night!

auto-merge was automatically disabled January 6, 2026 07:05

Head branch was pushed to by a user without write access

@eureka0928
Copy link
Copy Markdown
Contributor Author

eureka0928 commented Jan 6, 2026

@CommanderStorm would you enable auto merge again? I pushed the fix for testing
Sorry about this
cc: @louislam


let result;
const conditions = ConditionExpressionGroup.fromMonitor(monitor);
const hasConditions = conditions !== null;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This seems a bit sus, since the other instance of hasConditions in the codebase does this slightly differently.
Will need to manually verify which version is correct tomorrow.

Good night

@CommanderStorm CommanderStorm merged commit cc33a28 into louislam:master Jan 6, 2026
23 checks passed
@CommanderStorm CommanderStorm added this to the 2.1.0 milestone Jan 7, 2026
@louislam louislam mentioned this pull request Mar 17, 2026
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Monitor Mariadb SQL results

2 participants