opensearch-project / opensearch-project/data-prepper

Add dashboard inline asset to the blueprint

Open
#4,657 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Java
Stars
374
Forks
354
Avg merge
3d 18h
Merged PRs (30d)
8

Description

Is your feature request related to a problem? Please describe.
Today the blueprint contains a template field allowing to add an inline definition of the index template the ingestion should write into.

        ....
        template_content: >
          {
            "index_patterns": [
              "ss4o_metrics-*-*"
            ],
            "template": {
              "mappings": {
                "_meta": {
                ....

It would make much sense to add a similar capability to create a dashboard that shows the ingested data which corresponds to the data being ingested.

Describe the solution you'd like
In a similar manner to the template field, add a dashboard_content field that is an embedded ndjson file.
This part will call either the savedObject API of the Dashboards server or store the ndjson document directly in the .kibana index as a dashboard doc.

        ....
        dashboard_content: >
              {"attributes":{"description":"","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"title":"ingest-services-metrics-count","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"ingest-services-metrics-count\",\"type\":\"table\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"params\":{\"customLabel\":\"count\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"serviceName\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":25,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"service\"},\"schema\":\"bucket\"}],\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"showTotal\":false,\"totalFunc\":\"sum\",\"percentageCol\":\"\"}}"},"id":"cd23dc20-2f60-11ef-9514-4fea472f4f07","migrationVersion":{"visualization":"7.10.0"},"references":[{"id":"12a67740-2f60-11ef-9514-4fea472f4f07","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"visualization","updated_at":"2024-06-20T23:57:07.682Z","version":"WzU1LDFd"}
              {"attributes":{"description":"count services events","kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[],\"indexRefName\":\"kibanaSavedObjectMeta.searchSourceJSON.index\"}"},"title":"ingest-services-events-count","uiStateJSON":"{}","version":1,"visState":"{\"title\":\"ingest-services-events-count\",\"type\":\"table\",\"aggs\":[{\"id\":\"1\",\"enabled\":true,\"type\":\"count\",\"params\":{\"customLabel\":\"count\"},\"schema\":\"metric\"},{\"id\":\"2\",\"enabled\":true,\"type\":\"terms\",\"params\":{\"field\":\"serviceName.keyword\",\"orderBy\":\"1\",\"order\":\"desc\",\"size\":25,\"otherBucket\":false,\"otherBucketLabel\":\"Other\",\"missingBucket\":false,\"missingBucketLabel\":\"Missing\",\"customLabel\":\"service\"},\"schema\":\"bucket\"}],\"params\":{\"perPage\":10,\"showPartialRows\":false,\"showMetricsAtAllLevels\":false,\"showTotal\":false,\"totalFunc\":\"sum\",\"percentageCol\":\"\"}}"},"id":"a7d3d1a0-14f3-11ef-8c27-a723ded8020e","migrationVersion":{"visualization":"7.10.0"},"references":[{"id":"2ba34950-14f1-11ef-8c27-a723ded8020e","name":"kibanaSavedObjectMeta.searchSourceJSON.index","type":"index-pattern"}],"type":"visualization","updated_at":"2024-06-20T23:17:22.417Z","version":"WzE4LDFd"}
              ....

Additional context

# import  a saved objects 
curl \
    -snk \
    --netrc-file ~/.netrc \
    -H "Content-Type: application/json" \
    -H "osd-xsrf:true" \
    -XPOST \
    https://my.opensearch-dashboards.url/api/saved_objects/_import \
    -d '{"type":["index-pattern","config","search","dashboard","url","query","visualization"],"includeReferencesDeep":true}'

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No files or tests are named. Start by locating the blueprint handling for the existing template_content field, then review the proposed savedObject API or .kibana storage approaches; done means dashboard_content is accepted and its embedded NDJSON creates the intended dashboard assets.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.