Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Feature Request]: Query Results Cloudwatch dashboard #3681

Closed
2 of 5 tasks
ayang-629 opened this issue Aug 16, 2019 · 8 comments · Fixed by #7114
Closed
2 of 5 tasks

[Feature Request]: Query Results Cloudwatch dashboard #3681

ayang-629 opened this issue Aug 16, 2019 · 8 comments · Fixed by #7114
Assignees
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.

Comments

@ayang-629
Copy link

ayang-629 commented Aug 16, 2019

Note: for support questions, please first reference our documentation, then use Stackoverflow. This repository's issues are intended for feature requests and bug reports.

  • I'm submitting a ...

    • 🪲 bug report
    • 🚀 feature request
    • 📚 construct library gap
    • ☎️ security issue or vulnerability => Please see policy
    • ❓ support request => Please see note at the top of this template.
  • What is the current behavior?

Currently, the CDK just supports 4 of the 5 existing dashboard widgets: line, stacked, number, text.

  • What is the expected behavior (or behavior of feature suggested)?

There is a Query Results widget that allows us to put cloudwatch insights visualizations into dashboards

  • What is the motivation / use case for changing the behavior or adding this feature?

It's currently possible to hack a way to create that Widget via a call to CfnDashboard instead, but there should be a Class defined to handle this like there is for the other 4 widgets.

  • Please tell us about your environment:

    • CDK CLI Version: 1.13
    • Module Version: 1.13
    • OS: all
    • Language: Typescript
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)

@ayang-629 ayang-629 added the needs-triage This issue or PR still needs to be triaged. label Aug 16, 2019
@ninahaack
Copy link

Hi, do you have any idea when this feature will be released?

@vac-gollner
Copy link

Hi @ayang-629 , you mentioned "It's currently possible to hack a way to create that Widget via a call to CfnDashboard instead". What's the best way to have 2 widgets in this dashboard, one is graph widget, the other is query result widget? Do I have to use the hack way for both of them?

@ayang-629
Copy link
Author

@vac-gollner what I meant by "hack a way" is that CfnDashboard allows you to manually construct a string that includes the raw cfn configuration for a query result widget.

However, the reason one would prefer to use the CDK over say, the terraform option for this case is that instead of hard-coding a complex string (error-prone and tedious), a developer can programmatically define the desired infrastructure. This is what the CDK provides for most of the cloudwatch dashboard functionality, but not for the query result widget.

@vac-gollner
Copy link

@ayang-629 yes I totally agree. Now I am having a use case that I want to have both graph widgets and query result widget in a single dashboard. Because there is no such class like CfnWidget, I found I have to craft the whole JSON string in CfnDashboard, though graph widgets is supported by CDK.

@dhumeniuk
Copy link

You can extend the ConcreteWidget class to define your own custom widget implemntation where you define the JSON. Here's an example for a widget with an expression metric:

class ExpressionMetricWidget(construct: Construct, props: ExpressionMetricWidgetProps) extends ConcreteWidget(props.width, props.height) {
  val stack = Stack.of(construct)

  override def toJson = {
    jList(
      Map(
        "type" -> "metric",
        "width" -> getWidth,
        "height" -> getHeight,
        "x" -> getX,
        "y" -> getY,
        "period" -> "300",
        "properties" -> Map(
          "view" -> "timeSeries",
          "title" -> props.title,
          "region" -> stack.getRegion,
          "metrics" -> List(
            List(
              Map("expression" -> props.expression.getExpression)
            )
          )
        )
      )
    )
  }
}

@NGL321 NGL321 added feature-request A feature should be added or improved. @aws-cdk/aws-cloudwatch Related to Amazon CloudWatch and removed needs-triage This issue or PR still needs to be triaged. labels Oct 5, 2019
@NGL321
Copy link
Contributor

NGL321 commented Oct 5, 2019

Hey @ayang-629,
Thanks for submitting this feature request!

@ninahaack unfortunately we have long list of features to implement, so I cant give you a timeline on working on this one.

If someone would like to work on this and put in a PR, we can review and merge it into the codebase, otherwise one of us will update this issue when there is an update to this.

😸

@rix0rrr
Copy link
Contributor

rix0rrr commented Jan 3, 2020

Don't exactly know what support for this feature entails, but if is Math Expressions, that is being worked on in #5582

@MarcelloLins
Copy link

Adding more context to this feature request, because I think it may have been misinterpreted.

CloudWatch Dashboards contain widgets of various types, out of which CDK supports a few (alarm, graph, text etc). Currently CDK does not support the widget used to plot results of "CloudWatch Insight Queries".

Here's an example of how one of these widgets is represented by CloudWatch on a dashboard:

{ "type": "log", <--- Important "x": 0, "y": 36, "width": 9, "height": 9, "properties": { "query": "SOURCE '/aws/lambda/<LogGroupName>' | filter level=\"ERROR\" and message = \"EXCEPTION\"\n|stats count(*) as Count by message", "region": "us-east-1", "stacked": false, "title": "Count of Service Exceptions", "view": "table" } }
There is no current way to create a widget like this without extending an existing widget and overriding it's toJson method to generate a Json similar to the one above. The only two noteworthy changes to the JSON above (compared to existing ones) are the "type: log" and the new property called "query" which contains a log group followed by the CW Insights query itself.

I'm happy to provide more details if needed.

@eladb eladb assigned rix0rrr and unassigned eladb Jan 23, 2020
@rix0rrr rix0rrr added the effort/medium Medium work item – several days of effort label Jan 23, 2020
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 1, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes aws#3681
@SomayaB SomayaB added the in-progress This issue is being actively worked on. label Apr 3, 2020
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 18, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 18, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 18, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 25, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.
Also make `ILogGroup` extend `cloudwatch.IQueryLogGroup`
so it can be passed as a property for a `QueryWidget`.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 25, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.
Also make `ILogGroup` extend `cloudwatch.IQueryLogGroup`
so it can be passed as a property for a `QueryWidget`.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 25, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.
Also make `ILogGroup` extend `cloudwatch.IQueryLogGroup`
so it can be passed as a property for a `QueryWidget`.

closes aws#3681
OliverGavin pushed a commit to OliverGavin/aws-cdk that referenced this issue Apr 25, 2020
Add a `QueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.
Also make `ILogGroup` extend `cloudwatch.IQueryLogGroup`
so it can be passed as a property for a `QueryWidget`.

closes aws#3681
@mergify mergify bot closed this as completed in #7114 May 5, 2020
mergify bot pushed a commit that referenced this issue May 5, 2020
Add a `LogQueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes #3681
karupanerura pushed a commit to karupanerura/aws-cdk that referenced this issue May 7, 2020
Add a `LogQueryWidget` to generate a dashboard widget
showing the results of a query from Logs Insights.
This was a missing feature which is available in
the console.

closes aws#3681
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-cloudwatch Related to Amazon CloudWatch effort/medium Medium work item – several days of effort feature-request A feature should be added or improved. in-progress This issue is being actively worked on.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants