Hi everyone,
I went through this guide on developing an out-of-process adapter for Mixer (https://github.com/istio/istio/wiki/Mixer-Out-Of-Process-Adapter-Walkthrough). After spending a couple of days I got to the end, but one final issue is that while mixs server does pick up my adapter, handler, and instance from configuration, it doesn’t pick up the rule. Therefore, my adapter is not actually being called.
Here’s my configuration:
# handler for adapter applicationinsightsadapter
apiVersion: "config.istio.io/v1alpha2"
kind: handler
metadata:
name: h1
namespace: istio-system
spec:
adapter: applicationinsightsadapter
connection:
address: "[::]:33393" #replaces at runtime by the test
params:
file_path: "out.txt"
---
# instance for template metric
apiVersion: "config.istio.io/v1alpha2"
kind: instance
metadata:
name: i1
namespace: istio-system
spec:
template: metric
params:
value: request.size | 123
dimensions:
response_code: "200"
---
# rule to dispatch to handler h1
apiVersion: "config.istio.io/v1alpha2"
kind: rule
metadata:
name: r1
namespace: istio-system
spec:
actions:
- handler: h1
instances:
- i1
---
Here’s the debug output from Mixer (the part that appears relevant):
2019-02-08T00:27:17.735735Z debug Processing incoming handler config: name='h1.handler.istio-system'
&Handler{Name:,Adapter:applicationinsightsadapter,Params:&google_protobuf1.Struct{Fields:map[string]*Value{file_path: &Value{Kind:&Value_StringValue{StringValue:out.txt,},XXX_unrecognized:[],},},XXX_unrecognized:[],},Connection:&Connection{Address:[::]:33393,Timeout:<nil>,Authentication:nil,},CompiledAdapter:,}
2019-02-08T00:27:17.737227Z debug Begin processing rule configurations.
2019-02-08T00:27:17.737484Z info Built new config.Snapshot: id='4'
2019-02-08T00:27:17.737803Z debug config.Snapshot creation error=<nil>, contents:
ID: 4
TemplatesStatic:
Name: apikey
Name: authorization
Name: checknothing
Name: edge
Name: kubernetes
Name: listentry
Name: logentry
Name: metric
Name: quota
Name: reportnothing
Name: servicecontrolreport
Name: tracespan
AdaptersStatic:
Name: bypass
Name: circonus
Name: cloudwatch
Name: denier
Name: dogstatsd
Name: fluentd
Name: kubernetesenv
Name: listchecker
Name: memquota
Name: noop
Name: opa
Name: prometheus
Name: rbac
Name: redisquota
Name: servicecontrol
Name: signalfx
Name: solarwinds
Name: stackdriver
Name: statsd
Name: stdio
Name: zipkin
HandlersStatic:
InstancesStatic:
Rules:
AdaptersDynamic:
Name: applicationinsightsadapter.adapter.istio-system
Templates:
- metric.template.istio-system
TemplatesDynamic:
Resource Name: metric.template.istio-system
Name: metric.template.istio-system
InternalPackageDerivedName: metric
HandlersDynamic:
Name: h1.handler.istio-system
Adapter: applicationinsightsadapter.adapter.istio-system
As you can see, adapter, handler, and template are there, but the rules section is empty.
I’ve experimented with moving the rule around in the yaml configuration, and it appears that if I put the rule in front of everything else I do get an error “handler not found” (which makes sense), but as long as the rule remains at the end of the file - I can put any non-existent values in its fields, and there’s not even an error.
Is there a trick I should be aware of?
Thank you.