Closed rdhar closed 3 years ago
Per the community forum, it appears that each page of a dashboard can be queried individually with the following GraphQL:
{
actor {
entity(guid: "<dashboard_guid>") {
... on DashboardEntity {
pages {
guid
name
}
}
name
}
}
}
As such, it should be possible to source the same value via the provider's newrelic_entity
data.
Although this doesn’t address the underlying bootstrap issue—i.e., in order to build the dashboard, I need the dashboard to already exist—it might still offer a feasible workaround in the interim, until a more permanent resolution is found in #1193.
Will update this upon building a successful prototype.
Thank you for your detailed instructions. I was able to reproduce this, and found a few compounding issues, and a more detailed work-around.
Using the following GraphQL to search for a two page dashboard created per the initial snippet:
{
actor {
entitySearch(queryBuilder: {name: "jt-test-multi-page-1200", type: DASHBOARD}) {
results {
entities {
guid
name
}
}
}
}
}
Returns:
{
"data": {
"actor": {
"entitySearch": {
"results": {
"entities": [
{
"guid": "MjUyMDUyOHxWSVp8REFTSEJPQVJEfGRhOjExMjU2Mg",
"name": "jt-test-multi-page-1200"
},
{
"guid": "MjUyMDUyOHxWSVp8REFTSEJPQVJEfDE3MDUxMzU",
"name": "jt-test-multi-page-1200 / Page 1"
},
{
"guid": "MjUyMDUyOHxWSVp8REFTSEJPQVJEfDE3MDUxMzY",
"name": "jt-test-multi-page-1200 / Page 2"
}
]
}
}
}
}
}
So, based on this I tested with the following HCL to search for the entity.
data "newrelic_entity" "dashboard_example" {
name = "jt-test-multi-page-1200 / Page 1"
type = "DASHBOARD"
}
The name
format was ${dashboard name} / ${page name}
, then using linked_entity_guids = [ data.newrelic_entity.dashboard_example.guid ]
worked as expected.
@rdhar if you can verify this works for you as well, then I'll update the work-around in #1193 with another example, and we can close this out.
This is terrific! And co-incidentally, I came across the same resolution albeit in a much dumber way:
Seeing this pattern—as you described ${dashboard_name} / ${page_name}
—I gave it a shot and was surprised it worked just as expected via data.newrelic_entity
. Absolute madness.
Huge thanks for taking the time to address, really appreciate it. More than happy to see it closed, as #1193 supersedes this in terms of figuring out a way to self-reference dashboard pages during generation.
Thank you.
Summary
I'm unable to apply any filters on a multi-page
newrelic_one_dashboard
. This is distinct from #1193 since the suggested workaround is incompatible when dealing with multiple pages.I believe this to be a significant oversight given that a major component of NR1 dashboards is their innate interactivity: the lack of which is a major gap in reactive monitoring.
Expected Result
Given an NR1 dashboard with multiple pages, each one should be able to
FACET
filter on their respective page. Since there isn't a way to self-reference resources—addressed in #1193—I can import the dashboard'sGUID
vianewrelic_entity
before passing it into the widget'slinked_entity_guids = […]
.Actual Behaviour
Passing the imported
GUID
intolinked_entity_guids = […]
has no effect in filtering any of the dashboard's pages. Even after removing all but one page, there's no recovering it.(Uninformed) Investigation
Based on NR CLI's
newrelic decode
output, a regular 1-paged NR1 dashboard'sGUID
is in the format of<account_id>|VIZ|DASHBOARD|<insights_dashboard_id>
.As soon as another page is added, this format changes to
<account_id>|VIZ|DASHBOARD|da:<?>
, where I don't know whatda:
means or what<?>
's source is.Provider Configuration
Replication Steps
data
import and both of the lines starting withlinked_entity_guids
beforeterraform apply
.terraform apply
again in order to pass the dashboard'sGUID
into the widgets'linked_entity_guids = […]
.FACET
s are unable to filter.Toggle view of code snippet…
```tf data "newrelic_entity" "dashboard_example" { name = "Example Dashboard" type = "DASHBOARD" } resource "newrelic_one_dashboard" "dashboard_example" { name = "Example Dashboard" page { name = "Page 1" widget_pie { title = "This is on the first page" row = 1 column = 1 nrql_query { account_id = 123456 query = "FROM Transaction SELECT count(*) FACET appName" } linked_entity_guids = [data.newrelic_entity.dashboard_example.guid] } } page { name = "Page 2" widget_pie { title = "This is on the second page" row = 1 column = 1 nrql_query { account_id = 123456 query = "FROM Transaction SELECT count(*) FACET appName" } linked_entity_guids = [data.newrelic_entity.dashboard_example.guid] } } } ```Thank you.