Skip to content

feat: tooltip plugin to show series data in tooltip #6194

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

Merged
merged 7 commits into from
Oct 23, 2024

Conversation

YounixM
Copy link
Member

@YounixM YounixM commented Oct 15, 2024

Screenshot 2024-10-15 at 7 21 49 PM Screenshot 2024-10-15 at 7 21 59 PM

Important

Adds a tooltip plugin to display series data in tooltips on charts, integrating it into the anomaly alert evaluation view with updated styles and data processing.

  • Tooltip Plugin:
    • Adds tooltipPlugin in tooltipPlugin.ts to display series data in tooltips.
    • Handles mouse events to show/hide tooltips with series data.
  • Chart Integration:
    • Integrates tooltipPlugin into AnomalyAlertEvaluationView.tsx by adding it to the plugins array in chart options.
    • Updates AnomalyAlertEvaluationView.tsx to handle series selection and tooltip display.
  • Styles:
    • Adds styles for tooltips in AnomalyAlertEvaluationView.styles.scss.
    • Styles include tooltip appearance and scrollbar customization.
  • Data Processing:
    • Updates getUplotChartData.ts to generate colors for series based on dark mode and process anomaly detection data.
  • Misc:
    • Removes ANOMALY from metricQueryFunctionOptions in queryFunctionOptions.ts.
    • Adds deviation to alertDefaults in defaults.ts.
    • Updates RuleOptions.tsx to handle deviation changes.

This description was created by Ellipsis for e8ae733. It will automatically update as commits are pushed.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

@github-actions github-actions bot added the enhancement New feature or request label Oct 15, 2024
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Reviewed everything up to 0987122 in 50 seconds

More details
  • Looked at 346 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:5
  • Draft comment:
    Consider adding type definitions for the u parameter in the init and updateTooltip functions to improve type safety and code readability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The tooltipPlugin function is missing type definitions for the u parameter in the init and updateTooltip functions. This can lead to potential type-related issues and makes the code less readable.
2. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:12
  • Draft comment:
    Consider adding explicit type definitions for the return value of the formatValue function to improve clarity and type safety.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The formatValue function in tooltipPlugin.ts is handling multiple types but lacks explicit type definitions for its return value. This can lead to confusion and potential errors.
3. frontend/src/lib/uPlotLib/utils/getUplotChartData.ts:98
  • Draft comment:
    Consider adding specific type definitions for the anomalyDetectionData parameter in the processAnomalyDetectionData function to improve type safety and code readability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The processAnomalyDetectionData function in getUplotChartData.ts uses any type for its parameters, which can lead to potential type-related issues and makes the code less readable.
4. frontend/src/lib/uPlotLib/utils/getUplotChartData.ts:165
  • Draft comment:
    Consider passing the isDarkMode value as a parameter to getUplotChartDataForAnomalyDetection to ensure color generation aligns with the actual theme setting.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The getUplotChartDataForAnomalyDetection function in getUplotChartData.ts has a hardcoded isDarkMode value, which might not reflect the actual theme setting. This could lead to incorrect color generation based on the theme.
5. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:53
  • Draft comment:
    Consider adding a check to handle cases where u.data[i][idx] might be undefined to prevent potential runtime errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The updateTooltip function in tooltipPlugin.ts does not handle the case where u.data[i][idx] might be undefined, which could lead to runtime errors.

Workflow ID: wflow_C00JzzC4ki1TJTPh


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@YounixM YounixM force-pushed the feat/anomaly-detection-ui-tooltip-plugin branch from 0987122 to f78f0c6 Compare October 16, 2024 05:49
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on f78f0c6 in 40 seconds

More details
  • Looked at 346 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:22
  • Draft comment:
    Consider handling undefined values in formatValue function to ensure robustness.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment points out a potential issue where 'undefined' values are not explicitly handled in the 'formatValue' function. This could lead to unexpected behavior if 'undefined' values are passed to the function. The function currently handles 'null' values, so it might be reasonable to handle 'undefined' similarly. However, if 'undefined' values are not expected to be passed to this function, the comment might not be necessary.
    I might be overestimating the likelihood of 'undefined' values being passed to the function. The function might be used in a context where 'undefined' values are not possible, making the comment unnecessary.
    Even if 'undefined' values are not expected, handling them could prevent future issues if the function's usage changes. It's generally good practice to handle unexpected input gracefully.
    The comment is valid as it suggests an improvement in handling unexpected 'undefined' values, which could enhance the robustness of the function. It should be kept.
2. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:56
  • Draft comment:
    Consider optimizing the color generation in updateTooltip by using precomputed colors if available, to improve performance.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The updateTooltip function in tooltipPlugin.ts uses generateColor for each series in the loop, which might be inefficient if the color is already available in the series data. Consider optimizing this if possible.
3. frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx:304
  • Draft comment:
    Avoid using inline styles for setting backgroundColor. Use CSS classes or styled components instead. This applies to other inline styles in this file as well.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_JawjlXEtgyk4IqaS


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@YounixM YounixM force-pushed the feat/anomaly-detection-ui-tooltip-plugin branch from f78f0c6 to 14dc63b Compare October 22, 2024 09:06
Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 14dc63b in 34 seconds

More details
  • Looked at 346 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 1 drafted comments based on config settings.
1. frontend/src/container/AnomalyAlertEvaluationView/tooltipPlugin.ts:82
  • Draft comment:
    The marker variable is redefined multiple times. Consider defining it once and reusing it to improve code clarity and performance.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The marker variable is being redefined multiple times in the tooltipPlugin.ts file. This is unnecessary and can be optimized by defining it once and reusing it.

Workflow ID: wflow_8kD2VBVgdZik8dc9


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 739c832 in 57 seconds

More details
  • Looked at 469 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. frontend/src/constants/queryFunctionOptions.ts:3
  • Draft comment:
    The removal of the ANOMALY function from metricQueryFunctionOptions is consistent with the PR description.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description indicates that the anomaly function should be removed from the metricQueryFunctionOptions. The removal is correctly implemented here.
2. frontend/src/container/CreateAlertRule/defaults.ts:53
  • Draft comment:
    The addition of the deviation field with a default value of 3 is consistent with the PR description.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions the addition of a deviation field to the alert defaults. This change is correctly implemented here.
3. frontend/src/types/api/alerts/def.ts:49
  • Draft comment:
    The addition of the deviation field in RuleCondition is consistent with the PR description.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions the addition of a deviation field to the alert defaults. This change is correctly implemented here.
4. frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx:195
  • Draft comment:
    The handleSeriesChange function correctly updates the selected series, aligning with the PR's intent to handle series selection.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions handling series selection and tooltip display. The code correctly implements the logic for handling series selection.
5. frontend/src/container/AnomalyAlertEvaluationView/AnomalyAlertEvaluationView.tsx:155
  • Draft comment:
    The integration of tooltipPlugin into the chart options is consistent with the PR description.
  • Reason this comment was not posted:
    Confidence changes required: 0%
    The PR description mentions the integration of a tooltip plugin. The code correctly integrates the tooltip plugin into the chart options.
6. frontend/src/container/FormAlertRules/RuleOptions.tsx:268
  • Draft comment:
    Avoid using inline styles. Use CSS classes or styled components instead for the style attribute in the InlineSelect component. This is also applicable in other parts of the file where inline styles are used.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_B5OHEyBGAFKLxOKN


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on ee01d3c in 41 seconds

More details
  • Looked at 98 lines of code in 4 files
  • Skipped 0 files when reviewing.
  • Skipped posting 3 drafted comments based on config settings.
1. frontend/src/container/CreateAlertRule/defaults.ts:53
  • Draft comment:
    The default value for 'deviation' was removed but not replaced with a default for 'target'. Consider adding a default value for 'target' to avoid potential issues.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment is speculative as it assumes a potential issue without evidence. The rules state to only comment if there is a definite issue. There is no mention of 'target' in the diff or the file, so the comment does not seem relevant to the changes made.
    I might be missing some context about the 'target' field if it exists elsewhere in the codebase. However, based on the provided diff and file content, there is no indication that 'target' is relevant here.
    Given the lack of evidence in the provided context, the comment appears speculative and not directly related to the changes made.
    The comment should be deleted as it is speculative and not based on a definite issue related to the changes made in the diff.
2. frontend/src/container/FormAlertRules/index.tsx:161
  • Draft comment:
    The function 'updateFunctions' should be updated to use 'target' instead of 'deviation' in its logic.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. frontend/src/container/FormAlertRules/RuleOptions.tsx:217
  • Draft comment:
    Avoid using inline styles. Use external stylesheets, CSS classes, or styled components instead. This applies to other instances in this file as well.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_aWVp9vqQkNotquyY


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 7d40af4 in 46 seconds

More details
  • Looked at 188 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. frontend/src/container/CreateAlertRule/index.tsx:16
  • Draft comment:
    Typo: 'anamolyAlertDefaults' should be 'anomalyAlertDefaults'. This typo is present in multiple places in the codebase.
  • Reason this comment was not posted:
    Marked as duplicate.
2. frontend/src/container/FormAlertRules/index.tsx:152
  • Draft comment:
    Typo: 'ANOMALY_DETECTION_ALERT' is correct, but ensure consistency in naming conventions across the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The word 'anamoly' is misspelled. It should be 'anomaly'. This typo is present in multiple places in the code.
3. frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx:95
  • Draft comment:
    Typo: 'anomaly' is correct here, but ensure consistency in naming conventions across the codebase.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The word 'anamoly' is misspelled. It should be 'anomaly'. This typo is present in multiple places in the code.
4. frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx:203
  • Draft comment:
    Avoid using inline styles. Use external stylesheets, CSS classes, or styled components instead. This applies to other instances in this file as well.
  • Reason this comment was not posted:
    Comment was on unchanged code.
5. frontend/src/container/QueryBuilder/components/QueryFunctions/QueryFunctions.tsx:199
  • Draft comment:
    Use design tokens or predefined color constants instead of hardcoding color values. This applies to other instances in this file as well.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_0CzCszHsvg9UFbMd


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

❌ Changes requested. Incremental review on 8ebabdb in 41 seconds

More details
  • Looked at 82 lines of code in 2 files
  • Skipped 0 files when reviewing.
  • Skipped posting 2 drafted comments based on config settings.
1. frontend/src/container/FormAlertRules/index.tsx:260
  • Draft comment:
    The useEffect hook is missing 'location' as a dependency. This could lead to stale closures if 'location' changes but the effect doesn't re-run. Consider adding 'location' to the dependency array.
  • Reason this comment was not posted:
    Marked as duplicate.
2. frontend/src/container/FormAlertRules/index.tsx:89
  • Draft comment:
    Avoid using inline styles in React components. Consider using CSS classes or styled components instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_qJkbEcUWtYH0qWr3


Want Ellipsis to fix these issues? Tag @ellipsis-dev in a comment. You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

srikanthccv
srikanthccv previously approved these changes Oct 22, 2024
Copy link
Member

@srikanthccv srikanthccv left a comment

Choose a reason for hiding this comment

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

Functionally LGTM

Copy link

Build Error! No Linked Issue found. Please link an issue or mention it in the body using #<issue_id>

Copy link
Contributor

@ellipsis-dev ellipsis-dev bot left a comment

Choose a reason for hiding this comment

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

👍 Looks good to me! Incremental review on e8ae733 in 38 seconds

More details
  • Looked at 31 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/container/FormAlertRules/index.tsx:164
  • Draft comment:
    Consider using a constant for the event name in logEvent to avoid typos and make it easier to manage event names.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The logEvent function is used to log events, but the event name is hardcoded. It would be better to use a constant for the event name to avoid typos and make it easier to manage event names.
2. frontend/src/container/FormAlertRules/index.tsx:543
  • Draft comment:
    Consider using a constant for the event name in logEvent to avoid typos and make it easier to manage event names. This applies to other logEvent calls as well.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The logEvent function is used multiple times with hardcoded event names. It would be better to use constants for these event names to avoid typos and make it easier to manage event names.
3. frontend/src/container/FormAlertRules/index.tsx:628
  • Draft comment:
    Consider using a constant for the event name in logEvent to avoid typos and make it easier to manage event names. This applies to other logEvent calls as well.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The logEvent function is used multiple times with hardcoded event names. It would be better to use constants for these event names to avoid typos and make it easier to manage event names.
4. frontend/src/container/FormAlertRules/index.tsx:161
  • Draft comment:
    Avoid using inline styles. Consider using CSS classes or styled components instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_sPVMfG7iV6NPzwo2


You can customize Ellipsis with 👍 / 👎 feedback, review rules, user-specific overrides, quiet mode, and more.

@YounixM YounixM merged commit 9419f56 into develop Oct 23, 2024
12 of 14 checks passed
@YounixM YounixM deleted the feat/anomaly-detection-ui-tooltip-plugin branch October 23, 2024 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants