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

Looks like since version 1.3.0 STRING_MAP should be supported:

though I’m not being able to make it work using the example from the PR:

  • applying OOTB logentry template
  • applying the following instance:
    apiVersion: "config.istio.io/v1alpha2"
    kind: instance
    metadata:
     name: i1logentry
     namespace: istio-system
    spec:
     template: logentry
     params:
      timestamp: request.time
      variables:
        requestHeaders: request.headers | emptyStringMap()

I get this error in the mixer logs:

* instance='i1logentry.instance.istio-system'.params: config does not conform to schema of template 'logentry': unable to build message field: variables, unable to build message field: value, unsupported type: STRING_MAP (.istio.policy.v1beta1.Value)

I’ve tried both with clean demo installation of Istio 1.3.4 and 1.4.2 with the same result.
If the instance is changed to map a specific header instead of the header map, no error is shown.
any ideas?

Thanks

I’ve found out that only Istio API was updated to support STRING_MAP for Out of Process adapters but not the implementation. Are there any plans to include the implementation changes?

Thanks