Can't receive any kind of STRING_MAP s to istio mixer adapter

Hi there,

I developed a istio mixer adapter using the walkthrough here. I added more attributes to the dimensions in the instance. But after adding any kind of String map like source.labels or destination.labels I receive nothing. But, string from those map like source.labels[“app”] can be received without a problem.

apiVersion: "config.istio.io/v1alpha2"
kind: instance
metadata:
 name: i1metric
 namespace: istio-system
spec:
 template: metric
 params:
   dimensions:
     source_labels: source.labels | emptyStringMap()
     source_labels_app: source.labels["app"] | "unknown"

Thanks,
Hasitha

Looking at your example, I’m not sure I understand the use case.

What would the dimension source_labels look like when populated?

Prometheus, for example, only supports string labels. Is your desire to serialize all of the entries in the map into a single string and then have that be a dimension in the metrics? That seems potentially problematic (cardinality explosion, ordering issues, etc.), but that is probably besides the point.

The metric template only supports dimensions of type Value. This includes the following:

Field Type Description
stringValue string (oneof) Used for values of type STRING
int64Value int64 (oneof) Used for values of type INT64
doubleValue double (oneof) Used for values of type DOUBLE
boolValue bool (oneof) Used for values of type BOOL
ipAddressValue IPAddress (oneof) Used for values of type IPAddress
timestampValue TimeStamp (oneof) Used for values of type TIMESTAMP
durationValue Duration (oneof) Used for values of type DURATION
emailAddressValue EmailAddress (oneof) Used for values of type EmailAddress
dnsNameValue DNSName (oneof) Used for values of type DNSName
uriValue Uri (oneof) Used for values of type Uri

Notice that string map is not supported.

If you want a particular serialization of a string_map, you could consider extending Mixer to support a marshal() or toString() function that would convert a string map to a string and then use that.

Does that make sense?

Yes, I understood. Thank you