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: Add app hierarchy filter in Grafana #1014

Conversation

mateusoliveira43
Copy link
Collaborator

@mateusoliveira43 mateusoliveira43 commented Jun 2, 2023

Linked Issues

resolves #964

Description

Add hierarchy filter in Grafana dashboard by_app.

Testing Instructions

Create Pelorus instance with

kind: Pelorus
apiVersion: charts.pelorus.dora-metrics.io/v1alpha1
metadata:
  name: test-hierarchy-filter
  namespace: test-pelorus-operator
spec:
  exporters:
    global: {}
    instances:
      - app_name: webhook-exporter
        exporter_type: webhook

and run this script with the webhook endpoint

import argparse
import json
import time
from urllib import request

if __name__ == "__main__":
    parser = argparse.ArgumentParser()
    parser.add_argument("url", type=str)
    arguments = parser.parse_args()

    current_timestamp = int(time.time())

    for index, app in enumerate(
        [
            "group/subgroup/application_{index},class/application_{index}",
            "group/subgroup/application_{index}",
            "group/application_{index},class/application_{index}",
            "class/application_{index}",
            "group/application_{index}",
        ]
    ):
        json_data = json.dumps(
            {
                "app": app.format(index=index),
                "image_sha": "sha256:af4092ccbfa99a3ec1ea93058fe39b8ddfd8db1c7a18081db397c50a0b8ec77d",
                "namespace": "pelorus",
                "timestamp": current_timestamp,
            }
        )

        webhook_endpoint = request.Request(
            f"{arguments.url}/pelorus/webhook", method="POST"
        )
        webhook_endpoint.add_header("User-Agent", "Pelorus-Webhook/test")
        webhook_endpoint.add_header("X-Pelorus-Event", "deploytime")
        webhook_endpoint.add_header("Content-Type", "application/json")
        request.urlopen(url=webhook_endpoint, data=json_data.encode("utf-8"))

You will have the following structure

group/subgroup/application_0
group/subgroup/application_1
group/application_2
group/application_4
class/application_0
class/application_2
class/application_3

Selecting in Grafana each application individually should say 1 deployment happened, selecting subgroup should say 2, selecting group should say 4 and selecting class should say 3.

@mateusoliveira43 mateusoliveira43 self-assigned this Jun 2, 2023
@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 Jun 2, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 2, 2023

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@github-actions
Copy link

github-actions bot commented Jun 2, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-785bda8 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@github-actions
Copy link

github-actions bot commented Jun 2, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-ecb3057 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
@mateusoliveira43 mateusoliveira43 force-pushed the feat/grafana-app-hierarchy-filter branch from 7bc819f to c042336 Compare June 5, 2023 20:53
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-e76f531 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
@github-actions
Copy link

github-actions bot commented Jun 5, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-bcf42f0 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
@mateusoliveira43 mateusoliveira43 marked this pull request as ready for review June 6, 2023 02:20
@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 Jun 6, 2023
@openshift-ci openshift-ci bot requested review from etsauer and mpryc June 6, 2023 02:20
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-ec48023 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-e364a88 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

mpryc
mpryc previously approved these changes Jun 6, 2023
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 6, 2023
@mpryc
Copy link
Collaborator

mpryc commented Jun 6, 2023

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2023
@mateusoliveira43
Copy link
Collaborator Author

/hold

@openshift-ci openshift-ci bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 6, 2023
Signed-off-by: Mateus Oliveira <msouzaol@redhat.com>
@openshift-ci openshift-ci bot removed the lgtm Indicates that a PR is ready to be merged. label Jun 6, 2023
@openshift-ci
Copy link

openshift-ci bot commented Jun 6, 2023

New changes are detected. LGTM label has been removed.

@openshift-ci
Copy link

openshift-ci bot commented Jun 6, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from mateusoliveira43. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

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

@openshift-ci openshift-ci bot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 6, 2023
@mateusoliveira43
Copy link
Collaborator Author

\unhold

@openshift-ci
Copy link

openshift-ci bot commented Jun 6, 2023

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please ask for approval from mateusoliveira43. For more information see the Kubernetes Code Review Process.

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

Needs approval from an approver in each of these files:

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

@github-actions
Copy link

github-actions bot commented Jun 6, 2023

Test images available! 🧪🚀 To test operator with them, run

operator-sdk run bundle \
quay.io/pelorus/rc-pelorus-operator-bundle:vpr1014-407e721 \
--namespace test-pelorus-operator

To clean up environment afterwards, run

operator-sdk cleanup pelorus-operator --namespace test-pelorus-operator

@mateusoliveira43 mateusoliveira43 merged commit 6f3ee7d into dora-metrics:master Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dco-signoff: yes do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create filters in grafana to support subgroups views of apps
2 participants