Skip to content
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

Refactoring on Telemetry plugin #28542

Open
freddyDOTCMS opened this issue May 13, 2024 · 0 comments
Open

Refactoring on Telemetry plugin #28542

freddyDOTCMS opened this issue May 13, 2024 · 0 comments

Comments

@freddyDOTCMS
Copy link
Contributor

Parent Issue

No response

Problem Statement

Currently, the MetricType interface represents each calculated metric. If we want to calculate a new metric, we need a new class implementing the MetricType interface. However, the issue arises because this class contains metadata for each metric (such as name, category, feature, etc.) along with the code to calculate the metric's current value. This violates the Single Responsibility Principle.

The problem with this approach is evident when we look at the subclass, APiMetricType, which mixes metadata information with calculation logic. For instance, there's a method within this subclass specifically for calculating the unique hits for an endpoint.

Presently, when we store a hit in the temporary table, we save the MetricType for it. However, this value gets calculated even when we're not taking a metric snapshot at that moment.

Steps to Reproduce

  1. Start dotCMS using the full starter
  2. Hit the http://localhost:8082/api/v1/telemetry/stats Endpoint, check that all the IMAGE_API Metric are 0
  3. Request the Index Page
  4. Hit the http://localhost:8082/api/v1/telemetry/stats Endpoint Again, check that all the IMAGE_API Metric are 0 are still 0, on this point we already must have some values there

Also:

  • Run the follow query on the Database

select * from metrics_temp

Check the metric_type on any register, this is a JSON and you are going to see that this had a unique attribute

{ "description":"Count of '/dA/' API calls From Back End", "feature":"IMAGE_API", "name":"COUNT_OF_BE_DA_CALLS", "category":"DIFFERENTIATING_FEATURES" }

Acceptance Criteria

Split the MetricType Interface on 2 Interface one to set the Metadata and the other one to set the calculation code .

dotCMS Version

latest in Telemetry Plugin main branch

Proposed Objective

Core Features

Proposed Priority

Priority 2 - Important

External Links... Slack Conversations, Support Tickets, Figma Designs, etc.

No response

Assumptions & Initiation Needs

No response

Quality Assurance Notes & Workarounds

No response

Sub-Tasks & Estimates

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Gardening Day Backlog
Development

No branches or pull requests

1 participant