Skip to content

Change in --metrics-reporter in SDK 1.4.0 (snapshot 0729) causes confusing error message #6994

Closed
@jberthold-da

Description

When upgrading to SDK 1.4.0 (snapshot from 29 July), the sandbox metrics collection configuration we use stopped working. Previously we used a format like this --metrics-reporter graphite:influxdb:2003, which throws the following error in SDK 1.4.0

Error: Option --metrics-reporter failed when given 'graphite:influxdb:2003'. hostname can't be null
Try --help for more information.

This is due to the change in #6690, which introduces reading the value as a URI:

val uri = Read.uriRead.reads(value)
uri.getScheme match {
case "csv" => Csv(Paths.get(uri.getPath))
case "graphite" =>
val port = if (uri.getPort > 0) uri.getPort else Graphite.defaultPort
val address = new InetSocketAddress(uri.getHost, port)
val metricPrefix = Some(uri.getPath.stripPrefix("/")).filter(_.nonEmpty)
Graphite(address, metricPrefix)

The uriRead.reads call succeeds but uri.getHost == null which causes new InetSocketAddress(uri.getHost, port) to fail.

The exception thrown near the failing code says Must be one of "console", "csv:///PATH", or "graphite://HOST[:PORT][/METRIC_PREFIX]". which provides much better guidance than the help text:

$ daml sandbox --help
...
  --metrics-reporter <value>
...

Please consider adjusting the help text or/and catching and re-throwing the exception with more information.

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions