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

OU-432: Merge Perses dashboards with current dashboards list #266

Merged

Conversation

zhuje
Copy link
Contributor

@zhuje zhuje commented Nov 21, 2024

Description

On the dashboard page, list Perses dashboards in the dropdown.
This PR only lists the dashboards in the dropdown; the dashboard is not rendered when you click on the dropdown item.

OU-539_demo_list_perses_dashboards_ocp

Figure 1. Perses dashboards are listed in the dashboard page dropdown (e.g., "testproject / dashboard1" and "testproject / dashboard2"). The dashboards are displayed as <"project name"> / <"dashboard name">. The tag, by default, is "perses."

Related Issue

https://issues.redhat.com/browse/OU-432

Testing

This PR was only tested locally during development. To setup the test:

  1. Launch a perses container docker run --name perses -d -p 127.0.0.1:8080:8080 persesdev/perses. See https://github.com/perses/perses?tab=readme-ov-file#docker-images for information.
  2. Navigate to http://localhost:8080, which will take you to the local Perses instance. Create a project and a dashboard for it.
  3. Start the monitoring-plugin (make start-frontend and in a separate terminal make start-console). make start-console is proxying localhost:8080 (our local perses instance).
  4. There is a bug in the OCP console that prevents the Dashboard page from fetching the OCP dashboards specs -- to circumvent (with a hack-y solution) I've created a mock API response that serves the specs in this branch which you can merge in to the PR : https://github.com/zhuje/monitoring-plugin/tree/mock_monitoring_dashboard_config.
  5. Navigate to http://localhost:9000 (our local OCP instance). Go to Observe > Dashboards > Dropdown, the dashboards you created in the local perses instance should now be listed in the dropdown.

https://github.com/user-attachments/assets/7f6258e8-62de-46dc-8bd1-c7c598d628ea
Figure 2. Video demo of testing (~1:45 minutes). Shows perses dashboards are listed in the Dashboard page dropdown.

@zhuje zhuje marked this pull request as draft November 21, 2024 15:11
@openshift-ci openshift-ci bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Nov 21, 2024
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Nov 21, 2024
pkg/proxy/proxy.go Outdated Show resolved Hide resolved
@jgbernalp
Copy link
Contributor

As discussed in the tech sync, I don't think we need the proxy here as this will be handled by the proxy created in the ConsolePlugin CR

@openshift-merge-robot openshift-merge-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Nov 27, 2024
@zhuje zhuje force-pushed the OU-432_dashboard_perses_extension branch 2 times, most recently from 8c02ce8 to 6e49fb2 Compare December 3, 2024 20:44
@openshift-merge-robot openshift-merge-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 3, 2024
@zhuje zhuje marked this pull request as ready for review December 3, 2024 21:24
@openshift-ci openshift-ci bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Dec 3, 2024
@openshift-ci openshift-ci bot requested a review from PeterYurkovich December 3, 2024 21:25
@zhuje zhuje changed the title DRAFT: Add PersesURL feature flag to pass in url for Perses Dashboards OU-432: Merge Perses dashboards into current dashboards list Dec 3, 2024
@openshift-ci-robot openshift-ci-robot added the jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. label Dec 3, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 3, 2024

@zhuje: This pull request references OU-432 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

Description

On the dashboard page, list Perses dashboards in the dropdown.
This PR only lists the dashboards in the dropdown; the dashboard is not rendered when you click on the dropdown item.

OU-539_demo_list_perses_dashboards_ocp

Figure 1. Perses dashboards are listed in the dashboard page dropdown (e.g., "testproject / dashboard1" and "testproject / dashboard2"). The dashboards are displayed as <"project name"> / <"dashboard name">. The tag, by default, is "perses."

Related Issue

https://issues.redhat.com/browse/OU-432

Testing

This PR was only tested locally during development. To setup the test:

  1. Launch a perses container docker run --name perses -d -p 127.0.0.1:8080:8080 persesdev/perses. See https://github.com/perses/perses?tab=readme-ov-file#docker-images for information.
  2. Navigate to http://localhost:8080, which will take you to the local Perses instance. Create a project and a dashboard for it.
  3. Start the monitoring-plugin (make start-frontend and in a separate terminal make start-console). make start-console is proxying localhost:8080 (our local perses instance).
  4. There is a bug in the OCP console that prevents the Dashboard page from fetching the OCP dashboards specs -- to circumvent (with a hack-y solution) I've created a mock API response that serves the specs in this branch which you can merge in to the PR : https://github.com/zhuje/monitoring-plugin/tree/mock_monitoring_dashboard_config.
  5. Navigate to http://localhost:9000 (our local OCP instance). Go to Observe > Dashboards > Dropdown, the dashboards you created in the local perses instance should now be listed in the dropdown.

https://github.com/user-attachments/assets/7f6258e8-62de-46dc-8bd1-c7c598d628ea
Figure 2. Demo of testing. Shows perses dashboards are listed in the Dashboard page dropdown.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@zhuje zhuje changed the title OU-432: Merge Perses dashboards into current dashboards list OU-432: Merge Perses dashboards with current dashboards list Dec 3, 2024
@openshift-ci-robot
Copy link

openshift-ci-robot commented Dec 3, 2024

@zhuje: This pull request references OU-432 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.19.0" version, but no target version was set.

In response to this:

Description

On the dashboard page, list Perses dashboards in the dropdown.
This PR only lists the dashboards in the dropdown; the dashboard is not rendered when you click on the dropdown item.

OU-539_demo_list_perses_dashboards_ocp

Figure 1. Perses dashboards are listed in the dashboard page dropdown (e.g., "testproject / dashboard1" and "testproject / dashboard2"). The dashboards are displayed as <"project name"> / <"dashboard name">. The tag, by default, is "perses."

Related Issue

https://issues.redhat.com/browse/OU-432

Testing

This PR was only tested locally during development. To setup the test:

  1. Launch a perses container docker run --name perses -d -p 127.0.0.1:8080:8080 persesdev/perses. See https://github.com/perses/perses?tab=readme-ov-file#docker-images for information.
  2. Navigate to http://localhost:8080, which will take you to the local Perses instance. Create a project and a dashboard for it.
  3. Start the monitoring-plugin (make start-frontend and in a separate terminal make start-console). make start-console is proxying localhost:8080 (our local perses instance).
  4. There is a bug in the OCP console that prevents the Dashboard page from fetching the OCP dashboards specs -- to circumvent (with a hack-y solution) I've created a mock API response that serves the specs in this branch which you can merge in to the PR : https://github.com/zhuje/monitoring-plugin/tree/mock_monitoring_dashboard_config.
  5. Navigate to http://localhost:9000 (our local OCP instance). Go to Observe > Dashboards > Dropdown, the dashboards you created in the local perses instance should now be listed in the dropdown.

https://github.com/user-attachments/assets/7f6258e8-62de-46dc-8bd1-c7c598d628ea
Figure 2. Video demo of testing (~1:45 minutes). Shows perses dashboards are listed in the Dashboard page dropdown.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

cmd/plugin-backend.go Outdated Show resolved Hide resolved
web/src/components/dashboards/useFetchPersesDashboards.ts Outdated Show resolved Hide resolved
@jgbernalp
Copy link
Contributor

cc @fkargbo

@fkargbo
Copy link

fkargbo commented Dec 4, 2024

Looks good to me!

@zhuje zhuje force-pushed the OU-432_dashboard_perses_extension branch from 7a1b9f0 to 0f2956c Compare December 5, 2024 05:05
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to leave the perses-client to abstract the perses API as functions. See:
https://github.com/openshift/logging-view-plugin/blob/main/web/src/loki-client.ts

And then build in another file a usePerses hook that consumes this client. This hook should expose functions and probably a state so the consumers can decide when to query or reuse a persistent state.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I updated the files in the latest push.

  1. Added cancellable-fetch.ts ported from logging-view-plugin
  2. perses-client.ts modified to follow loki-client.ts from logging-view-plugin
  3. usePerses.ts created to follow useLogs.ts from logging-view-plugin
  4. ...dashboards/index.ts modified to utilize usePerses() hook

@zhuje zhuje force-pushed the OU-432_dashboard_perses_extension branch from c61c40d to a92a8e7 Compare December 6, 2024 05:37
@zhuje zhuje requested a review from jgbernalp December 6, 2024 05:45
@zhuje zhuje requested a review from PeterYurkovich December 9, 2024 14:20
@PeterYurkovich
Copy link
Contributor

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Dec 9, 2024
@jgbernalp
Copy link
Contributor

/lgtm

Copy link
Contributor

openshift-ci bot commented Dec 9, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jgbernalp, PeterYurkovich, zhuje

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [PeterYurkovich,jgbernalp,zhuje]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

openshift-ci bot commented Dec 9, 2024

@zhuje: all tests passed!

Full PR test history. Your PR dashboard.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. I understand the commands that are listed here.

@openshift-merge-bot openshift-merge-bot bot merged commit 5651a2f into openshift:main Dec 9, 2024
7 checks passed
@openshift-bot
Copy link

[ART PR BUILD NOTIFIER]

Distgit: monitoring-plugin
This PR has been included in build monitoring-plugin-container-v4.19.0-202412092010.p0.g5651a2f.assembly.stream.el9.
All builds following this will include this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. jira/valid-reference Indicates that this PR references a valid Jira ticket of any type. lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants