cog icon indicating copy to clipboard operation
cog copied to clipboard

Java: Fix alerting generation

Open spinillos opened this issue 1 year ago • 1 comments

Maps were adding the import only for references and we weren't checking if a reference was an array. In this second case, we were setting values like Matchers and ObjectMatchers that are array aliases and they aren't allowed in Java.

Before:

public Matchers matchers;
public ObjectMatchers objectMatchers;

After:

public List<Matcher> matchers;
public List<List<String>> objectMatchers;

spinillos avatar May 23 '24 10:05 spinillos

Note: in addition to the changes introduced by this PR, the diff includes unreleased changes living in main.

🔎 Changes to grafana-foundation-sdk@next+cog-v0.0.x

diff --git a/python/grafana_foundation_sdk/cog/plugins.py b/python/grafana_foundation_sdk/cog/plugins.py
index b2cec56..8efa24d 100644
--- a/python/grafana_foundation_sdk/cog/plugins.py
+++ b/python/grafana_foundation_sdk/cog/plugins.py
@@ -1,38 +1,38 @@
 # Code generated - EDITING IS FUTILE. DO NOT EDIT.
 
-from ..models import azuremonitor
-from ..models import parca
-from ..models import xychart
-from ..models import news
-from ..models import annotationslist
-from ..models import datagrid
-from ..models import geomap
-from ..models import googlecloudmonitoring
-from ..models import grafanapyroscope
 from ..models import nodegraph
-from ..models import cloudwatch
-from ..models import logs
-from ..models import trend
 from ..models import statetimeline
 from ..models import statushistory
+from ..models import barchart
+from ..models import news
+from ..models import elasticsearch
+from ..models import gauge
+from ..models import cloudwatch
 from ..models import bargauge
 from ..models import candlestick
+from ..models import geomap
+from ..models import timeseries
+from ..models import canvas
+from ..models import loki
+from ..models import piechart
+from ..models import prometheus
 from ..models import dashboardlist
-from ..models import elasticsearch
-from ..models import stat
+from ..models import histogram
 from ..models import text
-from ..models import canvas
+from ..models import xychart
+from ..models import annotationslist
+from ..models import azuremonitor
+from ..models import grafanapyroscope
+from ..models import table
 from ..models import debug
-from ..models import histogram
-from ..models import prometheus
-from ..models import barchart
-from ..models import gauge
-from ..models import piechart
+from ..models import googlecloudmonitoring
+from ..models import trend
+from ..models import stat
+from ..models import datagrid
 from ..models import heatmap
-from ..models import loki
-from ..models import table
+from ..models import logs
+from ..models import parca
 from ..models import tempo
-from ..models import timeseries
 from . import runtime as cogruntime
 
 
diff --git a/python/grafana_foundation_sdk/models/cloudwatch.py b/python/grafana_foundation_sdk/models/cloudwatch.py
index 761fcb8..4db2b96 100644
--- a/python/grafana_foundation_sdk/models/cloudwatch.py
+++ b/python/grafana_foundation_sdk/models/cloudwatch.py
@@ -894,7 +894,7 @@ CloudWatchQuery: typing.TypeAlias = typing.Union['CloudWatchMetricsQuery', 'Clou
 
 
 def variant_config() -> cogruntime.DataqueryConfig:
-    decoding_map: dict[str, typing.Union[typing.Type[CloudWatchMetricsQuery], typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchAnnotationQuery]]] = {"Metrics": CloudWatchMetricsQuery, "Logs": CloudWatchLogsQuery, "Annotations": CloudWatchAnnotationQuery}
+    decoding_map: dict[str, typing.Union[typing.Type[CloudWatchLogsQuery], typing.Type[CloudWatchAnnotationQuery], typing.Type[CloudWatchMetricsQuery]]] = {"Logs": CloudWatchLogsQuery, "Annotations": CloudWatchAnnotationQuery, "Metrics": CloudWatchMetricsQuery}
     return cogruntime.DataqueryConfig(
         identifier="cloudwatch",
         from_json_hook=lambda data: decoding_map[data["queryMode"]].from_json(data),
diff --git a/python/grafana_foundation_sdk/models/expr.py b/python/grafana_foundation_sdk/models/expr.py
index ea417d3..8297051 100644
--- a/python/grafana_foundation_sdk/models/expr.py
+++ b/python/grafana_foundation_sdk/models/expr.py
@@ -9,7 +9,7 @@ Expr: typing.TypeAlias = typing.Union['TypeMath', 'TypeReduce', 'TypeResample',
 
 
 def variant_config() -> cogruntime.DataqueryConfig:
-    decoding_map: dict[str, typing.Union[typing.Type[TypeThreshold], typing.Type[TypeSql], typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions]]] = {"threshold": TypeThreshold, "sql": TypeSql, "math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions}
+    decoding_map: dict[str, typing.Union[typing.Type[TypeMath], typing.Type[TypeReduce], typing.Type[TypeResample], typing.Type[TypeClassicConditions], typing.Type[TypeThreshold], typing.Type[TypeSql]]] = {"math": TypeMath, "reduce": TypeReduce, "resample": TypeResample, "classic_conditions": TypeClassicConditions, "threshold": TypeThreshold, "sql": TypeSql}
     return cogruntime.DataqueryConfig(
         identifier="__expr__",
         from_json_hook=lambda data: decoding_map[data["type"]].from_json(data),
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 6610f18..605a30f 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -13,7 +13,7 @@ keywords = [
     "traces",
     "metrics"
 ]
-version = "1716368518!next"
+version = "1716458777!next"
 dependencies = []
 requires-python = ">=3.11"
 classifiers = [
diff --git a/typescript/package.json b/typescript/package.json
index e9ad580..c6a78a4 100644
--- a/typescript/package.json
+++ b/typescript/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@grafana/grafana-foundation-sdk",
-  "version": "next-cogv0.0.x.1716368518",
+  "version": "next-cogv0.0.x.1716458777",
   "description": "A set of tools, types and libraries for building and manipulating Grafana objects.",
   "keywords": [
     "observability",

github-actions[bot] avatar May 23 '24 10:05 github-actions[bot]