Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Screenboard - incorrect log_query #49

Closed
flavio-cadete-cko opened this issue Mar 16, 2021 · 8 comments
Closed

Screenboard - incorrect log_query #49

flavio-cadete-cko opened this issue Mar 16, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@flavio-cadete-cko
Copy link
Contributor

Converting a widget doesn't return the correct query.
Instead we get:
log_query = [object Object]

@flavio-cadete-cko flavio-cadete-cko added the bug Something isn't working label Mar 16, 2021
@flavio-cadete-cko flavio-cadete-cko changed the title Screenboard - log_query = [object Object] Screenboard - incorrect log_query Mar 16, 2021
@laurmurclar
Copy link
Owner

Hi @flavio-cadete-cko, thanks for pointing this out!

Could you please give me a full example of a screenboard which results in this behavior? It'd be brilliant if you could give me the full expected output too. Cheers

@flavio-cadete-cko
Copy link
Contributor Author

Example:

UI:
image

Json:
image

TF:
image

@flavio-cadete-cko
Copy link
Contributor Author

"It'd be brilliant if you could give me the full expected output too. Cheers"
I'm still new to TF, so I'm figuring out how would translate to TF DataDog module/lib

@laurmurclar
Copy link
Owner

Thanks, appreciate the issue!

I've just committed a fix and I'll submit it to the store now. It can take a while to be approved, but you should see the fix by tomorrow :)

Btw, when giving the examples, it's best if you can copy-paste the whole screenboard like so, as it makes it easier for contributors to also copy-paste so they can reproduce the issue:

{
  "title": "Laura's Screenboard 7 Sep 2020 13:18",
  "description": "",
  "widgets": [
    {
      "id": 6396751932460267,
      "layout": { "x": 3, "y": 17, "width": 47, "height": 15 },
      "definition": {
        "title": "",
        "title_size": "16",
        "title_align": "left",
        "show_legend": false,
        "legend_layout": "vertical",
        "legend_columns": ["avg", "min", "max", "value", "sum"],
        "type": "timeseries",
        "requests": [
          {
            "q": "avg:system.cpu.user{*}",
            "style": {
              "palette": "dog_classic",
              "line_type": "solid",
              "line_width": "normal"
            },
            "display_type": "line"
          }
        ],
        "yaxis": {
          "scale": "linear",
          "label": "",
          "include_zero": true,
          "min": "auto",
          "max": "auto"
        },
        "markers": [
          { "label": " y = 5 ", "value": "y = 5", "display_type": "error dashed" },
          { "label": " y = 10 ", "value": "y = 10", "display_type": "error dashed" }
        ]
      }
    },
    {
      "id": 6396751932460267,
      "layout": { "x": 3, "y": 17, "width": 47, "height": 15 },
      "definition": {
        "title": "",
        "title_size": "16",
        "title_align": "left",
        "type": "timeseries",
        "requests": [
          {
            "log_query": {
              "index": "*",
              "search": {
                "query": "status:(error OR emergency)"
              },
              "group_by": [
                {
                  "facet": "service",
                  "sort": {
                    "order": "desc",
                    "aggregation": "count"
                  },
                  "limit": 10
                }
              ],
              "compute": {
                "aggregation": "count"
              }
            },
            "style": {
              "palette": "dog_classic",
              "line_type": "solid",
              "line_width": "normal"
            },
            "display_type": "line"
          }
        ]
      }
    },
    {
      "id": 6253560944158039,
      "layout": { "x": 52, "y": 0, "width": 47, "height": 15 },
      "definition": {
        "title": "Avg of system.cpu.user over *",
        "title_size": "16",
        "title_align": "left",
        "show_legend": false,
        "type": "heatmap",
        "requests": [{ "q": "avg:system.cpu.user{*}", "style": { "palette": "dog_classic" } }]
      }
    },
    {
      "id": 6629276995437899,
      "layout": { "x": 3, "y": 50, "width": 60, "height": 21 },
      "definition": {
        "title": "SLO: API requests",
        "title_size": "16",
        "title_align": "center",
        "type": "slo",
        "view_type": "detail",
        "time_windows": ["7d", "month_to_date", "global_time"],
        "slo_id": "301437ffe3e951a48fdbde5687d90609",
        "show_error_budget": true,
        "view_mode": "overall",
        "global_time_target": "5"
      }
    },
    {
      "id": 5597497359474697,
      "layout": { "x": 52, "y": 17, "width": 47, "height": 22 },
      "definition": {
        "title": "",
        "title_size": "16",
        "title_align": "left",
        "type": "hostmap",
        "requests": { "fill": { "q": "avg:system.cpu.user{*} by {host}" } },
        "node_type": "host",
        "no_metric_hosts": true,
        "no_group_hosts": true,
        "style": { "palette": "green_to_orange", "palette_flip": false }
      }
    }
  ],
  "template_variables": [],
  "layout_type": "free",
  "is_read_only": false,
  "notify_list": [],
  "id": "z9m-nan-9iq"
}

@flavio-cadete-cko
Copy link
Contributor Author

flavio-cadete-cko commented Mar 16, 2021

Something like this in Json:

"type": "toplist",
"requests": [
{
		"log_query": {
			"index": "transformation",
			"search": {
				"query": "source:due_diligence $dd_env $app_group @http.method:POST @Properties.StatusCode:201"
			},
			"group_by": [{
					"facet": "@CustomerId",
					"sort": {
						"order": "desc",
						"aggregation": "count"
					},
					"limit": 10
				}
			],
			"compute": {
				"aggregation": "count"
			}
		}
	}
]

would be translated to:

 request {
        log_query {
          index = "transformation"
          compute_query {
            aggregation = "count"
          }
          search_query = "source:due_diligence $dd_env $app_group @http.method:POST @Properties.StatusCode:201"
          group_by {
            facet = "@CustomerId"
            limit = 10
            sort_query {
              aggregation = "count"
              order       = "desc"
            }
          }
        }
        type = "toplist"
      }

But there are a lot of more options inside

@flavio-cadete-cko
Copy link
Contributor Author

Btw, when giving the examples, it's best if you can copy-paste the whole screenboard like so, as it makes it easier for contributors to also copy-paste so they can reproduce the issue:

Ok will do

@laurmurclar
Copy link
Owner

Thanks. That should work when the latest release is approved by the browser addon stores, feel free to re-open a new issue if it doesn't

@flavio-cadete-cko
Copy link
Contributor Author

flavio-cadete-cko commented Mar 16, 2021

Works now thanks

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants