Talaiot icon indicating copy to clipboard operation
Talaiot copied to clipboard

Consider supporting custom properties in other types than string

Open neworld opened this issue 2 months ago • 5 comments

Both the build and task custom properties support only strings, which prevents creating graphics based on them.

unsupported input type for mean aggregate: string

I guess, most naive solution by changing type <String, Any> should work and should be most bacnward compatible: https://github.com/cdsap/Talaiot/blob/master/library/core/talaiot/src/main/kotlin/io/github/cdsap/talaiot/entities/ExecutionReport.kt#L101-L102

My metric looks like:

class MyMetric(): GradleMetric<Long>(
  provider = { 42l },
  assigner = { report, value -> report.customProperties.buildProperties["mymetric"] = value.toString() }
)

neworld avatar Oct 26 '25 12:10 neworld

thanks @neworld, next week will take a look

cdsap avatar Oct 31 '25 22:10 cdsap

Hi @neworld, I have merged #467 supporting <String,Any> for custom metrics. In the configuration of the plugin you can define:

        customBuildMetrics(
            "kotlin" to "1.4",
            "java" to "8",
            "custom" to 3
        )

that will produce (json publisher):

   "buildProperties": {
      "kotlin": "1.4",
      "java": "8",
      "custom": 3
    },

and also support custom SimpleMetrics like:

class MyMetric():  io.github.cdsap.talaiot.metrics.base.GradleMetric<Long>(
    provider = { 42L },
    assigner = { report, value -> report.customProperties.buildProperties["mymetric"] = value }
)

generating:

  "customProperties": {
    "buildProperties": {
      "mymetric": 42,
      "kotlin": "1.4",
      "java": "8",
  },

It's available already in the 2.0.10-SNAPSHOT and I have plans to publish a new version this week

cdsap avatar Nov 11 '25 03:11 cdsap

Thanks! Can't wait to try it

neworld avatar Nov 11 '25 15:11 neworld

Version 2.1.0 adds support for different value types in metrics

cdsap avatar Nov 15 '25 16:11 cdsap

can I close the issue?

cdsap avatar Nov 19 '25 16:11 cdsap