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

feat: added logs and traces tab in host metrics detail view #6359

Open
wants to merge 11 commits into
base: host-lists
Choose a base branch
from

Conversation

rahulkeswani101
Copy link
Contributor

@rahulkeswani101 rahulkeswani101 commented Nov 4, 2024

Summary

Related Issues / PR's

Screenshots

image

Affected Areas and Manually Tested Areas


Important

Add logs and traces tabs to host metrics detail view with new components, styles, and utilities.

  • Behavior:
    • Add HostMetricLogsDetailedView and HostMetricTraces components for logs and traces in host metrics detail view.
    • Integrate components into HostMetricDetail for view switching.
    • Add isModalTimeSelection prop to HostDetailProps and DateTimeSelectionV2 for modal time selection.
  • Styles:
    • Add styles for HostMetricTraces in HostMetricTraces.styles.scss.
    • Update styles in InfraMonitoring.styles.scss for better layout and design.
  • Utilities:
    • Add formatNanoToMS utility in utils.ts for duration formatting.
    • Add getHostTracesQueryPayload and getHostLogsQueryPayload in constants.ts for query payloads.
  • Misc:
    • Update HostsList.tsx to use new HostMetricDetail with logs and traces.
    • Modify DateTimeSelectionV2 to support modal time selection.

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

Copy link

github-actions bot commented Nov 4, 2024

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 Nov 4, 2024
Copy link

github-actions bot commented Nov 4, 2024

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 c8bfe87 in 1 minute and 35 seconds

More details
  • Looked at 1035 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:22
  • Draft comment:
    The offset state is initialized but never updated. If pagination or data fetching with offset is intended, ensure to update this state accordingly.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:33
  • Draft comment:
    Consider resetting prevOffset and afterOffset when filters or timeRange changes to ensure correct data fetching.
  • Reason this comment was not posted:
    Marked as duplicate.
3. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogs.styles.scss:29
  • Draft comment:
    Use design tokens or predefined color constants instead of hardcoding color values for background properties. This applies to lines 29 and 33.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:166
  • Draft comment:
    Avoid using inline styles. Move the styles for the Skeleton component to an external stylesheet or use styled components. This applies to lines 166 and 182.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_EURKifo6WfC4sCTK


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
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 698a771 in 18 seconds

More details
  • Looked at 12 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 drafted comments based on config settings.

Workflow ID: wflow_vLunTA5PfMHU2s3E


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

Copy link

github-actions bot commented Nov 4, 2024

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

@rahulkeswani101 rahulkeswani101 changed the base branch from host-metrics to host-lists November 6, 2024 11:42
@rahulkeswani101 rahulkeswani101 changed the base branch from host-lists to host-metrics November 6, 2024 12:10
Copy link

github-actions bot commented Nov 6, 2024

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

@rahulkeswani101 rahulkeswani101 changed the base branch from host-metrics to host-lists November 6, 2024 12:10
Copy link

github-actions bot commented Nov 6, 2024

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 332f548 in 48 seconds

More details
  • Looked at 406 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. frontend/src/components/HostMetricsDetail/HostMetricsLogs/constants.ts:57
  • Draft comment:
    Using uuidv4() generates a new ID for each query payload. Ensure this is intended, as it will create a unique ID for every call.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of uuidv4() for generating query IDs is appropriate, but it should be noted that this will generate a new ID every time the function is called, which might not be necessary if the ID is meant to be consistent across calls for the same query. If the ID is meant to be unique for each call, then this is fine.
2. frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx:37
  • Draft comment:
    Inconsistent time conversion: initial state divides by 1000, while custom time change divides by 1000000000. Ensure consistent units.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:159
  • Draft comment:
    Ensure prevQueryPayload and afterQueryPayload are always defined when needed, as enabled: !!prevQueryPayload only checks for truthiness.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The HostMetricsLogs component uses useQuery with enabled: !!prevQueryPayload and enabled: !!afterQueryPayload. This is correct for conditional fetching, but ensure that prevQueryPayload and afterQueryPayload are always defined when needed, as !! only checks for truthiness.
4. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:162
  • Draft comment:
    Ensure skeleton-container styles are defined and applied correctly.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The HostMetricsLogs component uses Skeleton components with a class name skeleton-container. Ensure that the styles for this class are defined and applied correctly in the corresponding SCSS file.
5. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:169
  • Draft comment:
    Avoid using inline styles for the Virtuoso component. Consider using CSS classes or styled components instead.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_4UD8tRP0ZN8IwFfh


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

Copy link

github-actions bot commented Nov 6, 2024

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 2ecd830 in 39 seconds

More details
  • Looked at 411 lines of code in 5 files
  • Skipped 0 files when reviewing.
  • Skipped posting 7 drafted comments based on config settings.
1. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss:15
  • Draft comment:
    Avoid using !important in CSS. It can make debugging and maintenance difficult. Consider using more specific selectors or refactoring the CSS.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The use of !important in CSS should be avoided unless absolutely necessary, as it makes debugging and maintenance harder. It's better to use more specific selectors or refactor the CSS to achieve the desired effect without !important.
2. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:52
  • Draft comment:
    The offset state is initialized but never updated. Ensure that offset is updated appropriately if pagination is required.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:54
  • Draft comment:
    The setSelectedInterval state is defined but never used after initialization. Consider removing it if it's not needed.
  • Reason this comment was not posted:
    Confidence changes required: 30%
    The setSelectedInterval state is defined but never used after initialization. If it's not needed, consider removing it to clean up the code.
4. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:90
  • Draft comment:
    Ensure currentQuery.builder.queryData is not empty before accessing queryData[0] to avoid potential errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The query variable is checked for nullability before being used in JSX. However, if currentQuery.builder.queryData is empty, accessing queryData[0] could lead to an error. Consider adding a check for queryData length before accessing its first element.
5. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:181
  • Draft comment:
    Ensure data?.payload?.data?.newResult?.data?.result is not empty before accessing its elements to avoid potential errors.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    The totalCount calculation assumes that data?.payload?.data?.newResult?.data?.result is always an array with at least one element. This could lead to errors if the structure changes or if the data is not as expected. Consider adding checks to ensure the array is not empty before accessing its elements.
6. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.styles.scss:14
  • Draft comment:
    Use design tokens or predefined color constants instead of hardcoding color values.
  • Reason this comment was not posted:
    Comment was on unchanged code.
7. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:1
  • Draft comment:
    Avoid using the component/index.tsx file structure approach. It makes it difficult to debug and find components using global search tools.
  • Reason this comment was not posted:
    Comment was on unchanged code.

Workflow ID: wflow_ejFFUdX13wrclcWi


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

Copy link

github-actions bot commented Nov 6, 2024

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

@srikanthccv
Copy link
Member

@GeekBoySupreme
Copy link
Collaborator

@rahulkeswani101 can we move the pagination to the bottom of the table?

@srikanthccv
Copy link
Member

@GeekBoySupreme are you referring to the traces tab in detail view? We are taking the same component from traces explorer.

@srikanthccv
Copy link
Member

@rahulkeswani101 traces tabs issues https://www.loom.com/share/ddb69fafe8f0468d867c0f412b971690

  • Clicking on the item should open in trace detail page.
  • There should be a way to go to the Explorer page from the traces tab and logs tab to trace explorer and log explorer respectively.
  • There is weird loading issue when adding filters and moving pages

Copy link

github-actions bot commented Nov 8, 2024

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 af9f3dd in 45 seconds

More details
  • Looked at 927 lines of code in 13 files
  • Skipped 0 files when reviewing.
  • Skipped posting 6 drafted comments based on config settings.
1. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:116
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(dateTimeRange[0] / 1000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:122
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(minTime / 1000000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Marked as duplicate.
3. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx:92
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(dateTimeRange[0] / 1000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx:98
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(minTime / 1000000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Marked as duplicate.
5. frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx:47
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(dateTimeRange[0] / 1000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Marked as duplicate.
6. frontend/src/components/HostMetricsDetail/Metrics/Metrics.tsx:53
  • Draft comment:
    Ensure consistent time conversion factors across the codebase. Here, Math.floor(minTime / 1000000000) is used, but in other places, different factors are used. Verify the correct unit and apply consistently.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_oUBKgzlv6gVLGSSQ


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.

👍 Looks good to me! Incremental review on a7710e4 in 58 seconds

More details
  • Looked at 917 lines of code in 10 files
  • Skipped 0 files when reviewing.
  • Skipped posting 5 drafted comments based on config settings.
1. frontend/src/providers/QueryBuilder.tsx:919
  • Draft comment:
    Resetting the currentQuery to initialQueriesMap.metrics on route change to INFRASTRUCTURE_MONITORING_HOSTS may lead to unexpected behavior. Consider if this is the intended behavior.
  • Reason this comment was not posted:
    Comment did not seem useful.
2. frontend/src/components/HostMetricsDetail/HostMetricTraces/HostMetricTraces.tsx:50
  • Draft comment:
    Avoid using 'any' type for the traces state. Define a specific type for better type safety and code readability.
  • Reason this comment was not posted:
    Comment was on unchanged code.
3. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:38
  • Draft comment:
    Avoid using 'any' type for the logs state. Define a specific type for better type safety and code readability.
  • Reason this comment was not posted:
    Marked as duplicate.
4. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricLogsDetailedView.tsx:37
  • Draft comment:
    Avoid using 'any' type for the logs state. Define a specific type for better type safety and code readability.
  • Reason this comment was not posted:
    Marked as duplicate.
5. frontend/src/components/HostMetricsDetail/index.tsx:54
  • Draft comment:
    Avoid using 'any' type for the logs state. Define a specific type for better type safety and code readability.
  • Reason this comment was not posted:
    Marked as duplicate.

Workflow ID: wflow_9LLcxt1hzrR08O8e


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 aba6443 in 1 minute and 2 seconds

More details
  • Looked at 745 lines of code in 12 files
  • Skipped 0 files when reviewing.
  • Skipped posting 4 drafted comments based on config settings.
1. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:57
  • Draft comment:
    The isPaginating state is set but not used for any conditional logic. Consider removing it if it's not needed.
  • Reason this comment was not posted:
    Decided after close inspection that this draft comment was likely wrong and/or not actionable:
    The comment suggests that isPaginating is not used, but the code shows it is used in the useQuery hook and reset in a useEffect. This means the comment is incorrect.
    I might be missing some context about how isPaginating is intended to be used, but based on the code, it is clearly used for conditional logic.
    The code shows clear usage of isPaginating, so the comment is incorrect regardless of any additional context.
    The comment is incorrect because isPaginating is used in the code. It should be deleted.
2. frontend/src/components/HostMetricsDetail/HostMetricsLogs/HostMetricsLogs.tsx:124
  • Draft comment:
    Ensure that handleChangeLogFilters correctly handles pagination filters to avoid incorrect filtering.
  • Reason this comment was not posted:
    Comment did not seem useful.
3. frontend/src/container/TopNav/DateTimeSelectionV2/index.tsx:390
  • Draft comment:
    Consider refactoring onCustomDateHandler to improve readability and maintainability.
  • Reason this comment was not posted:
    Confidence changes required: 50%
    In DateTimeSelectionV2/index.tsx, the onCustomDateHandler function has a complex logic for handling custom date selection. It might be beneficial to refactor this function to improve readability and maintainability.
4. frontend/src/pages/InfraMonitoringHosts/InfraMonitoring.styles.scss:46
  • Draft comment:
    Use design tokens or predefined color constants instead of hardcoding color values for consistency. This is also applicable in other parts of this file.
  • Reason this comment was not posted:
    Comment looked like it was already resolved.

Workflow ID: wflow_WJmjNZuHMtLXhLtx


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.

handleChangeTracesFilters,
tracesFilters,
selectedInterval,
}: Props): JSX.Element {
const [traces, setTraces] = useState<any[]>([]);
const [offset] = useState<number>(0);
Copy link
Contributor

Choose a reason for hiding this comment

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

The offset state is not being updated anywhere in the component. Consider using a simple variable instead of useState.

Suggested change
const [offset] = useState<number>(0);
const offset = 0;

queryType: 'builder',
builder: {
...initialQueryState.builder,
queryData: [
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider implementing duplicate filter removal in handleChangeTracesFilters similar to handleChangeLogFilters.

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.

3 participants