grosser / kennel

Datadog monitors/dashboards/slos as code, avoid chaotic management via UI

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

show_legend not working

th11 opened this issue · comments

There seems to be an issue with managing legends through kennel.

This widget should have a compact legend defined.
https://github.com/zendesk/kennel/blob/b1361608c9458f96cdb53d1bdec7e08eadd7d52d/projects/classic_attachments/dashboards/classic_attachments.rb#L585-L586

legend_layout: "horizontal",
show_legend: true,

Example widget on datadog : https://zendesk.datadoghq.com/dashboard/ewm-ejt-5qc/classic-attachments?fullscreen_end_ts=1682371724827&fullscreen_paused=false&fullscreen_section=overview&fullscreen_start_ts=1682357324827&fullscreen_widget=2219576726347122&from_ts=1682356956553&to_ts=1682371356553&live=true

Missing legend
image
image

I tried manually deleting the widget in the UI then doing a manual update via kennel, which worked initially but eventually reverted to no legend showing at some point after, presumably when a kennel PR merged and it ran an update.

manually setting compact and then importing result in legend_layout: "horizontal" but no show_legend: true so remove that and update to see if compact stays

manually setting compact and then importing result in legend_layout: "horizontal" but no show_legend: true so remove that and update to see if compact stays

What exactly do you mean with importing result?

I manually set compact, used kennel:import

 URL='https://zendesk.datadoghq.com/dashboard/ewm-ejt-5qc/classic-attachments' bundle exec rake kennel:import | pbcopy

Then copied the relevant widget json:

{
                    definition: {
                      title: "Classic Attachments Throughput by Version",
                      type: "timeseries",
                      legend_layout: "horizontal",
                      requests: [
                        {
                          formulas: [
                            {
                              formula: "query1"
                            }
                          ],
                          queries: [
                            {
                              data_source: "spans",
                              name: "query1",
                              indexes: [
                                "trace-search"
                              ],
                              compute: {
                                aggregation: "count"
                              },
                              group_by: [
                                {
                                  facet: "@version",
                                  limit: 10,
                                  sort: {
                                    order: "desc",
                                    aggregation: "count"
                                  }
                                }
                              ],
                              search: {
                                query: "service:classic resource_name:(AttachmentsController#token OR \"Api::V2::UploadsController#create\" OR \"Api::V2::AttachmentsController#destroy\" OR AttachmentTokenController#show OR \"Api::V2::AttachmentsController#show\") $env $pod"
                              }
                            }
                          ],
                          response_format: "timeseries",
                          display_type: "bars"
                        }
                      ]
                    },

And then ran a manual kennel:update_datadog

 PROJECT=classic_attachments rake kennel:update_datadog --trace

which removed the legend again.

ah yeah :/

I set compact via the UI and then updated and it shows no diff for that widget.
I works when I use curl though with curl -X POST -H "Content-type: application/json" -d @dash.json "https://api.datadoghq.com/api/v1/dashboard?api_key=X&application_key=Y"

so what kennel is sending must have a bug ...
so dumped the api request from kennel and it's missing show_legend because it assumes true is the default ... that seems to not be the case, so we need to always set it and then it worked.

when creating through the api and leaving out show_legend, it ends up being not set ... but that seems to mean "false"
when creating via the UI it is always set to true even though a legend does not show up

Thanks for the quick fix!