-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
The grafana dashboard generated by the Grafana plugin is missing some key metrics. #3651
Comments
Hi @lingdie, Could you please describe and let us know how would you like to improve this one? c/c @Kavinjsir |
Hi @camilamacedo86, |
HI @lingdie, Please feel free to raise a pull request with all your suggestions. |
@camilamacedo86 @lingdie I think it a great idea to enrich the dashboard. Giving panels of
We may also utilize other metrics to enrich the dashboard, here is a reference from my previous proposal: Other than that, I'd also love to see if we can explore using new features of Grafana. The current manifests are backward compatible to Grafana v5, which I think is an old version. |
Marking this as triage accepted based on discussion with @Kavinjsir in the community meeting. Having default metrics which controller-runtime is providing should be a good start to the plugin. It is safe to assume that:
|
IHMO it would be great if we could add to the GitHub action an action for we check and have a preview of the Grafana dashboard, So that we can easier validate its changes. Could we address this one ? |
@camilamacedo86 That is ideal! Well, to have a "vivid" dashboard presented, are you suggesting that Github Action could provide a link to view Grafana similar to how we preview docs if updated? |
Hi @Kavinjsir
I think we need to ensure that we will be able to visualize the data. But todo this steps is not so hard see the PR to test out new e2e tests in the sample; https://github.com/kubernetes-sigs/kubebuilder/pull/3670/files#diff-995aca61b8f0f31632d3326ec143cc3bceb4ab730a97654d620cf7555d11eb42 |
@camilamacedo86 Looks good to me 👍🏼 |
IHMO if we could have a preview like we have for the docs would be amazing !!! |
Implementing graph previews in CI could be quite challenging and may add complexity to our existing workflow. We need to balance the benefits of this feature against the potential increase in complexity it might introduce. Additionally, there could be issues with the CI preview not generating the appropriate data or changes due to lack of load on the controllers, which might also affect the final presentation. This is another factor we need to consider when evaluating the feasibility of this feature. |
@Kavinjsir For now, maybe you can provide us a website or an video to preview this pr? |
Hi @lingdie,
I do not think so. How are you doing the tests locally?
See: https://github.com/kubernetes-sigs/kubebuilder/blob/master/.github/workflows/test-sample-go.yml |
@camilamacedo86 To enable a link to a Grafana UI for CI, I come up with two ways:
I'm not sure if we are on the same page, would you give some more context if I'm missing any part? Thx! |
Hi @Kavinjsir, First at all I agree that is not trivial and is a challenge. To Capture and Upload Screenshots to the GitHub Action:We can add a new job in our GitHub Actions workflow specifically for capturing screenshots of the Grafana dashboard. This process involves:
Here's an example workflow snippet along with the Node.js script: jobs:
capture-dashboard:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Puppeteer
run: npm install puppeteer
- name: Capture Grafana Dashboard Screenshot
run: node capture-screenshot.js
- name: Upload Screenshot
uses: actions/upload-artifact@v2
with:
name: grafana-dashboard
path: grafana-dashboard.png And the Node.js script (capture-screenshot.js): const puppeteer = require('puppeteer');
(async () => {
const browser = await puppeteer.launch();
const page = await browser.newPage();
await page.goto('http://localhost:3000'); // Replace with your Grafana URL
await page.screenshot({ path: 'grafana-dashboard.png' });
await browser.close();
})(); To configure Grafana and Prometheus we might need to do something like:
- name: Deploy Prometheus and Grafana
run: |
kubectl apply -f path/to/prometheus-deployment.yaml
kubectl apply -f path/to/grafana-deployment.yaml
Example grafana-datasource-config.yaml: apiVersion: v1
kind: ConfigMap
metadata:
name: grafana-datasources
namespace: monitoring
data:
prometheus-datasource.json: |-
{
"apiVersion": 1,
"datasources": [
{
"access": "proxy",
"editable": true,
"name": "Prometheus",
"orgId": 1,
"type": "prometheus",
"url": "http://prometheus-service:9090",
"version": 1
}
]
}
kubectl apply -f grafana-datasource-config.yaml # to push the config
In our Grafana deployment YAML, we will need to mount the ConfigMap as a volume. Grafana will automatically detect and use any datasource configurations found in Example snippet to add to your Grafana deployment YAML: volumes:
- name: grafana-datasources
configMap:
name: grafana-datasources
volumeMounts:
- name: grafana-datasources
mountPath: /etc/grafana/provisioning/datasources This mounts the ConfigMap in the Grafana pod at the directory where Grafana expects to find data source configurations.
- name: Port-forward Grafana
run: kubectl port-forward svc/grafana 3000:80 & So, at the end, it would be something like for example:jobs:
setup-and-capture:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up kind Cluster
run: |
# Add commands to set up kind cluster
- name: Set up sample with Grafana plugin and deploy it
run: |
# Add commands to set up sample with Grafana plugin and deploy it
- name: Setup Prometheus as Data source
run: |
# Add the code snippet for configuring Prometheus as a data source
- name: Deploy Prometheus and Grafana
run: |
kubectl apply -f path/to/prometheus-deployment.yaml
kubectl apply -f path/to/grafana-deployment.yaml
- name: Port-forward Grafana
run: |
kubectl port-forward svc/grafana 3000:80 &
sleep 10 # Waits for port-forward to establish
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '14'
- name: Install Puppeteer
run: npm install puppeteer
- name: Capture Grafana Dashboard Screenshot
run: node capture-screenshot.js
- name: Upload Screenshot
uses: actions/upload-artifact@v3
with:
name: grafana-dashboard
path: grafana-dashboard.png |
Using screenshots can indeed bypass issues related to domains and servers, but there are some additional details that need to be addressed:
|
@lingdie Would it be helpful for you to preview with the following resources given by the pr?
|
What do you want to happen?
As mentioned, the default generated dashboard is too simple.
ref to: #2183.
Extra Labels
No response
The text was updated successfully, but these errors were encountered: