jenkinsci / nested-data-reporting-plugin

Jenkins plugin to report data from nested as pie-charts, trend-charts and data tables.
https://plugins.jenkins.io/nested-data-reporting/
MIT License
5 stars 5 forks source link
build-reports csv data-charts jenkins jenkins-pipeline jenkins-plugin json metrics nested-data nested-json plot reporting ui user-interface view views xml yaml yml

GitHub GitHub tag (latest by date) GitHub pull requests Open GitHub issues GitHub Workflow Status Build Status Jenkins Plugins Jenkins Plugin installs


Logo

Nested Data Reporting Plugin

Jenkins plugin to report data from nested data as pie-charts, trend-charts and data tables.
Explore the docs »

Report Bug · Request Feature

Introduction

This plugin visualizes user-specific content from various file formats, such as json, yaml, xml or csv. The UI displays information in various graphs and tables, like pie-charts, history charts and data tables.

Usage

User-specific files such as Json files are the starting point, containing the content to be displayed. You need to provide an id and a list of items. Each item in this list can have a further list of items. However, an item on the lowest level must then contain a result. This result can be any combination of key, value pairs. If an item has items, the result will be computed automatically for this parent item. Please make sure you use a unique identifier for the id!

An example json file looks like this:

{
  "id": "my-json-report"
  "items": [
    {
      "id": "stocks",
      "name": "Stocks",
      "items": [
        {
          "id": "alphabet",
          "name": "Google",
          "result": {
            "incorrect": 1,
            "manually": 1,
            "accurate": 4
          }
        },
        {
          "id": "microsoft",
          "name": "Microsoft",
          "result": {
            "incorrect": 2,
            "manually": 1,
            "accurate": 5
          }
        }
      ]
    },
    {
      "id": "derivates",
      "name": "Derivates",
      "result": {
        "incorrect": 2,
        "manually": 3,
        "accurate": 10
      }
    },
    {
      "id": "fonds",
      "name": "Fonds",
      "result": {
        "incorrect": 6,
        "manually": 7,
        "accurate": 20
      }
    },
    {
      "id": "warrants",
      "name": "Warrants",
      "result": {
        "incorrect": 6,
        "manually": 4,
        "accurate": 15
      }
    }
  ],
  "colors": {
    "incorrect": "#EF9A9A",
    "manually": "#FFF59D",
    "accurate": "#A5D6A7"
  }
}

ui

To check your json you can use the json schema to validate it.

⚠️ Color Mapping:

You can provide a color mapping. Then, please make sure, that the attribute colors needs exactly the same attributes as the result of the items and assigns a color to each attribute, which is used for the graphical representation. Otherwise a default color #E9E9E9 is used for the missing property!

You can use own HEX values or the following predefined colors are supported:

  • YELLOW
  • LIME
  • GREEN
  • BLUE
  • TEAL
  • ORANGE
  • INDIGO
  • PURPLE
  • RED
  • BROWN
  • GRAY
  • WHITE

If no colors object is provided, a color palette will be calculated.

If your items only have one result, the visualization is different from the default one, because the representation then makes no sense. Instead of the attributes of the result object, the keys of the individual items are used as the basis for distribution. For example:

{
  "id": "my-second-json-report"
  "items": [
    {
      "id": "Aktie",
      "name": "Aktie",
      "items": [
        {
          "id": "Aktie_1",
          "name": "Aktie 1",
          "result": {
            "incorrect": 3541
          }
        },
        {
          "id": "Aktie_2",
          "name": "Aktie 2",
          "result": {
            "incorrect": 4488
          }
        },
        {
          "id": "Aktie_3",
          "name": "Aktie 3",
          "result": {
            "incorrect": 2973
          }
        }
      ]
    },
    {
      "id": "Not_Found",
      "name": "Not_Found",
      "result": {
        "incorrect": 8701
      }
    },  
    {
      "id": "Renten",
      "name": "Renten",
      "items": [
        {
          "id": "Rente_1",
          "name": "Rente1",
          "result": {
            "incorrect": 5762
          }
        },
        {
          "id": "Rente_2",
          "name": "Rente2",
          "result": {
            "incorrect": 2271
          }
        }
      ]
    },
    {
      "id": "Derivat",
      "name": "Derivat",
      "result": {
        "incorrect": 2271
      }
    }
  ],
  "colors": {
    "Aktie": "GREEN",
    "Aktie_1": "YELLOW",
    "Aktie_2": "RED",
    "Aktie_3": "PURPLE",
    "Not_Found": "BROWN",
    "Renten": "ORANGE",
    "Rente_1": "TEAL",
    "Rente_2": "BLUE",
    "Derivat": "INDIGO"
  }
}

Then your dashboard looks like this: ui

Supported file formats

Visualization

At job level, a trend chart is generated showing the development of the items included in the json over all builds.

Since version 2.4.0, the view is dynamically built and always contains a pie chart, a history and a table.

The pie chart and the hsitory show the aggregated results of the underlying items.

The table then shows the individual underlying items and visualizes the distribution of the properties in the table.

By clicking on a corresponding row, the view is filtered according to the selection. However, the structure remains the same. This can be continued until no more subitems are available in the json model. On the lowest level only the pie chart and the history will be displayed.

Getting started

Pipeline Step

For examples of report files and pipelines, please have look into etc folder.

publishReport name: "JSON Report", displayType: "dual", provider: json(pattern: "etc/report-1-part-*.json")
publishReport name: "XML Report", displayType: "dual", provider: xml(pattern: "etc/*.xml")
publishReport name: "YAML Report", displayType: "dual", provider: yaml(pattern: "etc/*.yaml")
publishReport name: "CSV Report", displayType: "dual", provider: csv(id: "csv-one", pattern: "etc/*.csv")

Parameter:

name:

Choose a name for the report. The name is shown in the UI.

displayType (optional, default = absolute):

This can be used to change the display of the displayed metrics within the distribution table. 'absolute' shows the absolute values from the underlying files. 'relative', shows percentage values and 'dual' shows the absolute value and additionally the relative frequency within the category.

provider:

Choose a provider that should find and parse the files based on the given pattern. If all files found have the same ID and can be structurally merged, they are merged into one report. The id of the first report file found will be used as master id. All following reports of the pattern must match it, otherwise they are ignored.

id (only required for CSV provider):

Specify the id of the report to tag the result and to find reports of past builds. Just required for CSV provider.

pattern:

This is an ant include pattern for the files should be parsed and scanned (see Patterns in the Apache Ant Manual). Multiple includes can be specified by separating each pattern with a comma.

Issues

Report issues and enhancements in the GitHub Issue Tracker

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

LICENSE

Licensed under MIT, see LICENSE