Developer Guide

Monitoring and Diagnostics

There are several tools and practices that will help you to achieve various levels of monitoring and provide you with insight into how your users are using extensions. This will help you offer support as well as help them diagnose issues themselves.

Your Extend installation can be configured to export logging information to your own AWS Firehose service. This provides you with the capability to store and analyze logs generated by your users’ extensions in Amazon S3, Amazon ElasticSearch, Amazon Kinesis Analytics, or Amazon Redshift. The logging information contains all output generated by your user’s extension code to standard output, as well as selected infrastructure events generated by Extend itself. Contact support if you are interested in configuring this capability.

For development and ongoing support of your customers, you can also leverage access to real-time logs. These logs can be made available to your customers via the Extend editor to support their debugging and development by enabling the logging panel via the allowAccessingLogs setting.

logging

One way to conveniently stream real-time logging information is to use the wt-cli command line tool. Before you can use it, you need to configure a profile based on your master webtask token - this will allow you to connect to the webtask container of any of your customers:

wt init -p master \
  --url {host_url} \
  --token {master_webtask_token} \
  --container master

You can then use the wt logs command to attach to any webtask container and stream logging information generated by any of the extensions running in it:

wt logs -p master --container {tenant_webtask_container}

The wt-cli tool can also be used to inspect the source code of the extensions your customers have created. Depending on the level of support you choose to provide your customers, this may be a capability that can save your support team a lot time and effort. To list extensions defined in a specific webtask container, run:

wt ls -p master --container {tenant_webtask_container}

(note that the result is paged).

Next, to obtain the code of a specific extension from the list, run:

wt inspect -p master --container {tenant_webtask_container} {webtask_name} --fetch-code

NOTE never share the master webtask token with your customers.

There are a few good practices to follow to improve your diagnostics capabilities when integrating Extend into your platform; these include:

  • Log extension invocations. Every time you invoke an extension, it is worthwhile to capture the following information in the logs of your platform:

    • The overall execution time of the extension.
    • The response status code.
    • The following response headers: x-wt-response-source, x-auth0-proxy-stats, s-auth0-stats
    • Consider if and which parts of the response to capture in logs, since there may be sensitive information embedded in the response.
  • Log extension discovery calls. Every time you call the extension discovery, it is worthwhile to capture the entire response in your logs (after removing any sensitive information, e.g. webtask tokens).