Skip to content
This repository has been archived by the owner on May 23, 2023. It is now read-only.

~(Obsolete) Testing standalone mixer (Development)

Scott Ganyo edited this page Sep 9, 2019 · 1 revision

build

bin/local_install.sh

to build with debug for delve:

DEBUG=1 bin/local_install.sh

create your mixs config

Be sure to set the appropriate values in the source files first. If you change the source values, remember to rerun this cat command.

ADAPTER_DIR=$GOPATH/src/github.com/apigee/istio-mixer-adapter
MIXER_DIR=$GOPATH/src/istio.io/istio/mixer

cat $ADAPTER_DIR/samples/apigee/definitions.yaml \
  $ADAPTER_DIR/samples/apigee/handler.yaml \
  $ADAPTER_DIR/samples/apigee/rule.yaml \
  > $MIXER_DIR/testdata/config/apigee.yaml

run mixer server

Set mixer cmd dir to release build:

MIXER_CMD_DIR=$GOPATH/out/linux_amd64/release

Or debug build:

MIXER_CMD_DIR=$GOPATH/out/linux_amd64/debug

note: on Mac OS, use MIXER_CMD_DIR=$GOPATH/out/darwin_amd64/release or MIXER_CMD_DIR=$GOPATH/out/darwin_amd64/debug

Then run mixs:

$MIXER_CMD_DIR/mixs server --alsologtostderr --configStoreURL=fs://$MIXER_DIR/testdata/config --log_output_level default:error,attributes:info,adapters:debug

or, to run mixs with delve:

dlv --listen=:2345 --headless=true --api-version=2 exec $MIXER_CMD_DIR/mixs -- server --alsologtostderr --configStoreURL=fs://$MIXER_DIR/testdata/config --log_output_level default:error,attributes:info,adapters:debug

mixer check examples

check api key from header:

API_KEY=<your api key>

$MIXER_CMD_DIR/mixc check \
--string_attributes="destination.service=helloworld.default.svc.cluster.local,request.path="/"" \
--stringmap_attributes="request.headers=x-api-key:$API_KEY,destination.labels=istio:test"

check api key from request:

API_KEY=<your api key>

$MIXER_CMD_DIR/mixc check \
--string_attributes="destination.service=helloworld.default.svc.cluster.local,request.path="/",request.api_key=$API_KEY"

mixer report examples

report analytics (update times as appropriate):

API_KEY=<your api key>
REQUEST_TIME=2018-05-01T01:00:00Z
RESPONSE_TIME=2018-05-01T01:00:01Z

$MIXER_CMD_DIR/mixc report \
--string_attributes='destination.service=helloworld.default.svc.cluster.local,request.path="/",request.method="GET",request.useragent="mixc"' \
--stringmap_attributes="request.headers=x-api-key:$API_KEY,destination.labels=istio:test" \
--timestamp_attributes="request.time=$REQUEST_TIME,response.time=$RESPONSE_TIME"