Skip to content

Proposal: Add initial telemetry metrics feature (backend endpoints, JS, and HTML template)#4042

Open
ldelreguero wants to merge 2 commits into
kiwitcms:masterfrom
ldelreguero:metrics-ldelregueromartinez
Open

Proposal: Add initial telemetry metrics feature (backend endpoints, JS, and HTML template)#4042
ldelreguero wants to merge 2 commits into
kiwitcms:masterfrom
ldelreguero:metrics-ldelregueromartinez

Conversation

@ldelreguero

Copy link
Copy Markdown

This PR introduces a proposal for a new telemetry metrics feature.
It includes:

Backend endpoints for telemetry metrics
JavaScript files for metrics handling and testing
An initial HTML template for displaying metrics
The goal is to start a discussion and gather feedback on the approach and implementation.

Please note:
This contribution was created entirely with the help of AI, so I expect there will be a lot of work needed to polish and improve the code. I apologize in advance for any rough edges and appreciate your understanding and feedback!

@atodorov atodorov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sorry for taking so long to review. Here are some initial set of comments.

Comment thread tcms/static/js/index.js

import { pageTelemetryReadyHandler } from '../../telemetry/static/telemetry/js/index'

import { drawTable as pageTelemetryMetricsReadyHandler } from '../../telemetry/static/telemetry/js/testing/metrics'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please rename the original function instead of the import, see line above.

Comment thread tcms/static/js/jsonrpc.js
if ((result.error.code === 401 || result.error.code === 403) && document.body.id === 'login') {
// do nothing
}
// Optionally handle error here (alert removed)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why do we need this here, please explain ?

Similar comment for lines 35-38 below ?

Doesn't appear to be necessary unless you can explain what kind of problem are you trying to solve.

Comment thread tcms/telemetry/api.py
from tcms.testruns.models import TestExecution, TestExecutionStatus
from tcms.testcases.models import TestCase, TestCasePlan
from tcms.testplans.models import TestPlan
from tcms.testruns.models import TestExecution, TestExecutionStatus, TestRun

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please see reported issue about unused import. Run pylint/isort/black lcoally too.

Formatting can be improved.

.dataTables_paginate .ellipsis {
padding: 4px 8px;
color: #888;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

CSS overrides must be in a separate .css file. If that's supposed to be used globally then add them to static/style/. Otherwise make a static file which would be included in the HTML template only for this page.


{% block extra_js %}
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@3.4.1/dist/css/bootstrap.min.css">

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

None of these are acceptable.

  1. You should not be including static files which are already included in base.html
  2. All linked files must have their src specified by {% static %} (as in line 97 below)
  3. Should use dependencies and versions which are already in package.json, not reinvent the wheel
  4. If there are missing dependencies they should be specified in package.json

} else {
$('#metrics-help-block-server').hide();
}
});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Default security setup blocks inline scripts from executing on first page load.

  1. Move this into metrics.js
  2. Please test your code before pushing it to GitHub.

@atodorov atodorov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please rebase on top of latest code since it's been a while.

@atodorov atodorov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is what this proposed feature looks like:
Image

maybe I am missing something due to lack of test data, however it looks very similar to the already existing feature:
Image

Question:

What is the intended use-case for this new telemetry page ? I need to figure out what the overlap with existing implementation is b/c it looks suspiciously close and I think there is a better way to implement this.

@ldelreguero

Copy link
Copy Markdown
Author

Así es como se ve esta característica propuesta: Imagen

Tal vez me estoy perdiendo algo debido a la falta de datos de prueba, sin embargo, se parece mucho a la característica ya existente: Imagen

Pregunta:

¿Cuál es el caso de uso previsto para esta nueva página de telemetría? Necesito averiguar cuál es la superposición con la implementación existente porque parece sospechosamente cercana y creo que hay una mejor manera de implementarla.

Alexander,

At the time I created issue #4038 and later tried — with many errors along the way — to generate this PR, I was attempting to explore some metrics.

Test Execution Coverage = (Total number of executed test cases or scripts / Total number of test cases or scripts planned to be executed) x 100

Passed Test Cases Coverage = (Number of passed tests / Total number of tests executed) x 100

Failed Test Case Coverage = (Number of failed tests / Total number of test cases executed) x 100

Unexecuted cases = (Unexecuted tests / Total cases of test run) × 100

Test Cases Blocked = (Number of blocked tests / Total number of tests executed) x 100

Number of Test Run Per Time Period= (Number of test run / Total time)

Quality Ratio = (Successful Tests Cases / Total Number of Tests Cases) x 100

Schedule Variance = [(Actual efforts – estimated efforts) / Estimated Efforts)] x 100

Although it is completely true that this information could already be visualized from the test run itself, at that time I thought it could also be displayed as standalone metrics.

My context has changed, and I no longer consider these metrics useful. Please reject the PR, and I also propose closing issue 4038.

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.

3 participants