1. 程式人生 > >Building a simple public API on API Connect v5

Building a simple public API on API Connect v5

  • High-Level Analysis of the transaction (Debugging)

    In addition to using the Activity-Log policy for debugging purposes, a more indepth look into the transaction may be conducted on the syslogs and probe on the DataPower Gateway. You will not have access to the DataPower Gateway on Bluemix, therefore this section only applies to the on-prem environment.

    The syslog and probe for the API calls will be found in the APIC generated domain on DataPower.

    If you have multiple DataPower domains on a system, you may find the APIC generated ID from the CMC Services, listed in the DataPower Service section under DataPower Domain:

    apicGeneratedDomain

    Debug Logs (syslogs)

    WARNING

    : Debug logging may impact performance, therefore, it should be avoided in production.

    • The syslog level is defaulted to warning level for APIC generated domains. 
    • The syslog file itself is titled default-log, and the name of rotated files are as follows: default-log.1, default-log.2, and default-log.3 (log rolls every 500KBs).
    • The syslog is written to the logtemp directory of the File Management, therefore you may view the raw logs from the logtemp, or through a visual friendly parsed System Logs section of the DataPower WebUI:

    syslogLocation-1

    • Setting the log level is in the Troubleshooting section of the webui. You will want to set this to Debug log level when debugging.

    loglevel

    Most error transactions will not include the transaction ID, therefore, to narrow down the error, you must cross-reference the URI of the call, the time of when the error took place, and any other key indicators from the API.

    The start of the transaction will acknowledge that DataPower recieved the transaction.

    The syslog includes the datetime, the event ID, the service object type, the log level, protocol, transaction ID, client IP, and log message, as shown below. The example below is the last transaction from API created in this tutorial.

    20170531T024253.740Z [0x80e0013a][mpgw][info] source-https(webapi-https): tid(36981154)[192.168.88.1]: Received HTTP/1.1 GET for /demo/sb/myloopbackapi from 192.168.88.1

    Once the desired log details are found, the transaction ID may be cross-referenced for all the logs that belong to the particular transaction which you are debugging.

    At debug level, the syslogs contain over 300 lines of debug details, therefore we wil not be looking at the full logs, although, to note that each log detail walks through each processing step throughout the APIC framework on the gateway, therefore, when an error is thrown, it is a good indicator of where to debug.

    The Probe

    WARNING: Probes may impact performance, therefore, it should be avoided in production.

    • The Probe can be enabled in each gateway object, but the Troubleshooting section contains consolidated Probes you can enable/disable under the Debug Probe tab.

    probes

    The probes will be rarely used for APIC work, unless there are deeper DataPower development work done such as building User-Defined Policies or Extensions.

    The probe would be used mostly when APIC developers would like to leverage DataPower variables which may not be exposed for APIC, to verify that the context variables are being set properly, verify headers, troubleshoot DataPower extension variables, and/or etc.

    By expanding the one transaction line item in the probe shown in the figure above, you will see that there are several calls made to process the request and response. The developer can see each step of the call, action to action.

    The figure in this section shows a sample of analyzing the request transaction in one spot of DataPower as it traverses through the gateway:
    1. Expansion of the transaction to see all the processing rules
    2. Selection of the rule right before the response
    3. Selection of the final action taken of this particular rule
    4. and view of DataPower context variables used and/or can be used in this request alone.

    probesDissected-1

    From the same screen as shown in the figure above, the APIC developer will be able to scroll down to find the “var://context/_apimgmt/readContext” variable to see what APIC context variables are being set  (after clicking show node to open the page). All these variables are listed in the API Connect context variable knowledge center page.

    probeContextVar-1

    The APIC developer may also see the headers and response body of the transaction.

    probeHeaders-2

    probeBody-1

    The take-away from this section is, the APIC developer can set and get variables from the system memory and leverage them for custom code, view headers for the transaction, the body of the message, and/or analyze the request for any additional errors which the error logs may not output.

    Most of the time, leveraging the syslogs are enough for debugging.

  • 相關推薦

    Building a simple public API on API Connect v5

    High-Level Analysis of the transaction (Debugging) In addition to using the Activity-Log policy for debugging purposes, a more indepth look into the trans

    Building a Simple Web App With Bottle, SQLAlchemy, and the Twitter API

    Last October we challenged our PyBites’ audience to make a web app to better navigate the Daily Python Tip feed. In this article, I’ll share what I buil

    Building a Keras + deep learning REST API(三部曲之一)

    and from urn -h png app 比較 get round 一、基本環境$ pip install flask gevent requests pillow其中 flask不需要解釋gevent 是用於自動切換進程的;pillow 是用來進行python下的圖

    Building a Simple Chatbot from Scratch in Python (using NLTK)

    So what is a chatbot?A chatbot is an artificial intelligence-powered piece of software in a device (Siri, Alexa, Google Assistant etc), application, websit

    a simple game based on RT-Thread

    【作品名稱】   a simple game based on RT-Thread 【背景描述】   學了一段時間的嵌入式作業系統RT-Thread,發現是真的好用。於是想做一個小作品來鍛鍊鞏固自己學習的知識。(童年的記憶啊^_^) 【所用物料及實物圖】   實物圖:     

    Building a Software/SaaS Business on AWS – the ISV Partner Playbook from Splunk

    The following is a guest post from our friends at Splunk, an all-in AWS Technology Partner, and AWS SaaS Partner.  As AWS increasingly bec

    A practical ES6 guide on how to perform HTTP requests using the Fetch API

    In this guide, I’ll show you how to use the Fetch API (ES6+) to perform HTTP requests to an REST API with some practical examples you’ll most likely encoun

    Tutorial for building a Web Application with Amazon S3, Lambda, DynamoDB and API Gateway

    Tutorial for building a Web Application with Amazon S3, Lambda, DynamoDB and API GatewayI recently attended Serverless Day at the AWS Loft in downtown San

    extract-text-webpack-plugin配置問題:Tapable.plugin is deprecated. Use new API on `.hooks`instead

    在webpack4中配置extract-text-webpack-plugin時,npm run build後報錯 DeprecationWarning: Tapable.plugin is deprecated. Use new API on `.hooks`

    A simple survey on inpainting

    From Wikipedia, inpainting is the process of reconstructing lost or deteriorated parts of images and videos. In my opinion, besides

    前端提交multipart/form-data資料,由api服務A將請求轉發到api服務B

    maven依賴: <dependency> <groupId>commons-httpclient</groupId> <artifactId>commons-httpclient</artifactI

    HTTP errors are often intermittent, and a simple retry will get you on your way. ConnectionError

    使用anaconda安裝scrapy是報錯:HTTP errors are often intermittent, and a simple retry will get you on your way. ConnectionError(ReadTimeoutError("HTTPSConnec

    Correct the ImageView's adjustViewBounds behaviour on API Level 17 and below with AdjustableImageView

    A requirement that almost every single application has is "I want to scale up an ImageView proportionally to fit its parent. How can I do

    My notes on building a creative agency

    A few years ago I decided to start a creative agency. Note - I had no idea what I was doing (I was previously an excel jockey on Wall St.). I tried Googlin

    A Simple Intuition for Overfitting, or Why Testing on Training Data is a Bad Idea

    Tweet Share Share Google Plus When you first start out with machine learning you load a dataset

    Host a Public Website on Amazon EC2 Using IIS

    Amazon Web Services is Hiring. Amazon Web Services (AWS) is a dynamic, growing business unit within Amazon.com. We are currently hiring So

    Increase Bandwidth for Active Traffic on Direct Connect using a LAG

    A virtual interface (dxvif-A) is associated with a Direct Connect connection (dxcon-A) and is actively passing traffic. In order to increase th

    Can I use the Profile API on the client-side? Documentation

    For security reasons, we require the Profile API only be used server-side. The Profile API allows you to look up data about any user given an identifier (e

    webpack報錯Tapable.plugin is deprecated. Use new API on `.hooks` instead

     webpack問題一: 原因: extract-text-webpack-plugin目前版本不支援webpack4 解決方式一: npm install --save-dev [em

    關於CUDA兩種API:Runtime API 和 Driver API

    ive uda ++ etime bsp con spa runt cuda CUDA 眼下有兩種不同的 API:Runtime API 和 Driver API,兩種 API 各有其適用的範圍。高級API(cuda_runtime.h)是一種C