From a28a9a38a5f49ad079ab3df03c99392ee490e418 Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 9 Jul 2020 10:20:34 -0700 Subject: [PATCH 1/2] Add some docs on using tracing Signed-off-by: Ian Costanzo --- demo/AgentTracing.md | 98 ++++++++++++++++++++++++++++++++++++++++ demo/EFK-stack/README.md | 12 +++++ 2 files changed, 110 insertions(+) create mode 100644 demo/AgentTracing.md diff --git a/demo/AgentTracing.md b/demo/AgentTracing.md new file mode 100644 index 0000000000..dfff9399ab --- /dev/null +++ b/demo/AgentTracing.md @@ -0,0 +1,98 @@ +# Using Tracing in ACA-PY + +The aca-py agent supports message tracing, according to the [Tracing RFC](https://github.com/hyperledger/aries-rfcs/tree/master/features/0034-message-tracing). + +Tracing can be enabled globally, for all messages/events, or it can be enabled on an exchange-by-exchange basis. + +Tracing is configured globally for the agent. + +## ACA-PY Configuration + +The following options can be specified when starting the aca-py agent: + +``` + --trace Generate tracing events. + --trace-target + Target for trace events ("log", "message", or http + endpoint). + --trace-tag + Tag to be included when logging events. + --trace-label + Label (agent name) used logging events. +``` + +The `--trace` option enables tracing globally for the agent, the other options can configure the trace destination and content (default is `log`). + +Tracing can be enabled on an exchange-by-exchange basis, by including `{ ... "trace": True, ...}` in the JSON payload to the API call (for credential and proof exchanges). + +## Enabling Tracing in the Alice/Faber Demo + +The `run_demo` script supports the following parameters and environment variables. + +Environment variables: + +``` +TRACE_ENABLED Flag to enable tracing + +TRACE_TARGET_URL Host:port of endpoint to log trace events (e.g. fluentd:8088) + +DOCKER_NET Docker network to join (must be used if EFK stack is running in docker) + +TRACE_TAG Tag to be included in all logged trace events +``` + +Parameters: + +``` +--trace-log Enables tracing to the standard log output + (sets TRACE_ENABLED, TRACE_TARGET, TRACE_TAG) + +--trace-http Enables tracing to an HTTP endpoint (specified by TRACE_TARGET_URL) + (sets TRACE_ENABLED, TRACE_TARGET, TRACE_TAG) +``` + +When running the Faber controller, tracing can be enabled using the `T` menu option: + +```bash +Faber | Connected + (1) Issue Credential + (2) Send Proof Request + (3) Send Message + (T) Toggle tracing on credential/proof exchange + (X) Exit? +[1/2/3/T/X] t + +>>> Credential/Proof Exchange Tracing is ON + (1) Issue Credential + (2) Send Proof Request + (3) Send Message + (T) Toggle tracing on credential/proof exchange + (X) Exit? + +[1/2/3/T/X] t + +>>> Credential/Proof Exchange Tracing is OFF + (1) Issue Credential + (2) Send Proof Request + (3) Send Message + (T) Toggle tracing on credential/proof exchange + (X) Exit? + +[1/2/3/T/X] +``` + +When `Exchange Tracing` is `ON`, all exchanges will include tracing. + +## Logging Trace Events to an EFK Stack + +You can use the `EFK` stack in the [EFK sub-directory](./EFK-stack) as a target for trace events, just start the EFK stack using the docker-compose file and then in two separate bash shells, startup the demo as follows: + +```bash +DOCKER_NET=efk-stack_efk_net TRACE_TARGET_URL=fluentd:8088 ./run_demo faber --trace-http +``` + +```bash +DOCKER_NET=efk-stack_efk_net TRACE_TARGET_URL=fluentd:8088 ./run_demo alice --trace-http +``` + + diff --git a/demo/EFK-stack/README.md b/demo/EFK-stack/README.md index 90d00bc26f..e7e956055e 100644 --- a/demo/EFK-stack/README.md +++ b/demo/EFK-stack/README.md @@ -65,6 +65,18 @@ Files are available in the [examples](examples) folder. Please note that RESTed is not strictly necessary as any other REST client application will work fine. +## Running the aca-py Alice/Faber Demo Tracing using EFK + +In two separate bash shells, startup the demo as follows: + +```bash +DOCKER_NET=efk-stack_efk_net TRACE_TARGET_URL=fluentd:8088 ./run_demo faber --trace-http +``` + +```bash +DOCKER_NET=efk-stack_efk_net TRACE_TARGET_URL=fluentd:8088 ./run_demo alice --trace-http +``` + ## Reference - [Quora - What is the ELK stack](https://www.quora.com/What-is-the-ELK-stack) From f937b4fea726d5bbcaf9a1250c0670f6dfc5181f Mon Sep 17 00:00:00 2001 From: Ian Costanzo Date: Thu, 9 Jul 2020 16:09:53 -0700 Subject: [PATCH 2/2] Fix bash syntax issue Signed-off-by: Ian Costanzo --- demo/AgentTracing.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/demo/AgentTracing.md b/demo/AgentTracing.md index dfff9399ab..ed511971ab 100644 --- a/demo/AgentTracing.md +++ b/demo/AgentTracing.md @@ -53,7 +53,7 @@ Parameters: When running the Faber controller, tracing can be enabled using the `T` menu option: -```bash +``` Faber | Connected (1) Issue Credential (2) Send Proof Request