<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    use AWS X-Ray to collect diagnostics information

    In this exercise, you will analyze and collect diagnostics information related to your application with AWS X-Ray. With AWS X-Ray, you can understand how your application and its underlying services are performing to identify and troubleshoot the root cause of performance issues. AWS X-Ray traces user requests as they travel through your entire application. It then aggregates the data generated by the individual services and resources that make up your application, providing you with a trace map of how your application is performing. 
    Note: Make sure to sign in to your AWS account with the AWS IAM user edXProjectUser credentials.

    To begin, follow the steps below.

    1. Start the RDS database instance

    • In the AWS Console, click Services, then click Relational Database Service to open the Amazon RDS dashboard.
    • In the left navigation pane, click Instances. From the list of instances, select edx-photos-db.
    • At the top, click Instance actions, and then click Start.

    2. Download and explore the exercise code.

    • Type the command below in your AWS Cloud9 terminal to make sure you are in the ~/environment directory of your AWS Cloud9 instance.

      cd ~/environment
    • In your AWS Cloud9 environment, download the exercise code by typing the command below in the terminal.
    • wget https://us-west-2-tcdev.s3.amazonaws.com/courses/AWS-100-ADG/v1.0.0/exercises/ex-xray.zip

    • Unzip the exercise code .zip file by typing the command below in your AWS Cloud9 terminal.
    • unzip ex-xray.zip

      The contents of the .zip file should be extracted to a folder with a similar name. You can view the folder on the left tree view.

    • Open the exercise-xray/FlaskApp/application.py file and explore the code. Notice that the AWS X-Ray libraries, such as aws_xray_sdk.core, xray_recorder, and XRayMiddleware, are now being imported in the application.py file. AWS X-Ray is configured with XRayMiddleware to gather tracing information for different services and report the information back into the AWS cloud.
    • Open the exercise-xray/util.py file. Notice that there is a @xray_recorder.capture() decorator, which captures the time needed to resize the uploaded photo to a desired size. This information is reported back to the AWS cloud.

    3. Download and run the AWS X-Ray daemon on your AWS Cloud9 instance.

    4. Run the exercise code and test the application.

    • To run the exercise code, you will need to point the Run Configuration to the correct exercise folder. In the Python3RunConfiguration pane at the bottom, in the Command text box, type the text shown below and then click Run.
    • exercise-xray/FlaskApp/application.py

      A message like the one below should appear.

      Running on http://0.0.0.0:5000/

    • Make sure to establish an SSH tunnel to your AWS Cloud9 instance. You may refer to the steps in the previous exercise for creating an SSH tunnel.
    • Open http://localhost:5000, log in to the application with your credentials, and upload a photo. Click My photos at the top-right corner of the application. You should see your uploaded photo.
    • Go to your AWS Cloud9 instance terminal and notice that the AWS X-Ray daemon is sending diagnostics information to your AWS account. You should see information as shown in the screenshot below.

    5. Explore the diagnostics information collected by AWS X-Ray.

    • In the AWS Console, click Services, then click X-Ray to open the AWS X-Ray dashboard.
    • If you are using AWS X-Ray for the first time, you may have to click Get Started and then click Cancel to exit the wizard.
    • Click Service map in the left navigation menu. The service map has information about AWS services communicating with each other and the processing time each service needs.
    • On the left side, click Traces. You should see response times and time taken by each component in the application.
    • In the Trace list at the bottom, click the trace item where the Method column contains POST. You should see timing information for all the calls made in your application, as shown in the screenshot below. This particular trace information should be about the POST made to the application to upload a photo. Notice the time needed for Amazon S3, Amazon RDS and Amazon Rekognition to process the photo. You can also see the time needed to resize the image against the resize_image label.
    • With this diagnostics information, you can now find out which component in your application is taking longer to process.

    Optional Challenge 1

    AWS X-Ray allows us to add searchable annotations to the trace segment. For more information, see Recording Annotations with the X-Ray SDK for Python.

    The code below will pick up the current X-Ray segment from the xray_recorder.

    from aws_xray_sdk.core import xray_recorder
    ...
    document = xray_recorder.current_segment()
    

    Inside the homepage route, can you add an annotation to the current segment containing the user's nickname? When this is reported back to AWS Cloud9, you will be able to search traces by username.

    Optional Challenge 2

    AWS X-ray will capture and report exceptions. Can you add some code to create an exception - for example, a new route that simply divides a number by zero? Run this new code with X-Ray configured. You will see the stack trace captured and viewable in the X-Ray console.

    6. Stop the Amazon RDS database instance.

    In order to keep your AWS account bill to a minimum, consider stopping the Amazon RDS instance and then starting it again when needed. Follow the steps below to stop the Amazon RDS database instance.

    • In the AWS Console, go to the Amazon RDS dashboard.
    • In the left navigation pane, click Instances. From the list of instances, select edx-photos-db.
    • At the top, click Instance actions, and then click Stop. A prompt will appear. Click Yes, stop now.


    眼鏡蛇

    posted on 2018-04-19 11:23 眼鏡蛇 閱讀(125) 評論(0)  編輯  收藏 所屬分類: AWS

    <2025年5月>
    27282930123
    45678910
    11121314151617
    18192021222324
    25262728293031
    1234567

    導(dǎo)航

    統(tǒng)計

    常用鏈接

    留言簿(6)

    隨筆分類

    隨筆檔案

    文章分類

    文章檔案

    搜索

    最新評論

    閱讀排行榜

    評論排行榜

    主站蜘蛛池模板: 国产精品二区三区免费播放心| 免费无码中文字幕A级毛片| 全免费一级毛片在线播放| 亚洲videos| 最新猫咪www免费人成| 亚洲天堂男人影院| 一二三四影视在线看片免费| 国产精品亚洲四区在线观看| 四虎国产精品免费久久| 亚洲成在人线在线播放无码| 看全色黄大色大片免费久久| 牛牛在线精品免费视频观看| 亚洲日本韩国在线| a在线视频免费观看| 亚洲另类激情综合偷自拍 | 免费无遮挡无码视频在线观看| 日韩免费a级毛片无码a∨ | 久久久久久久久久免免费精品 | 久草免费福利在线| 亚洲爱情岛论坛永久| 18国产精品白浆在线观看免费| 亚洲色大成WWW亚洲女子| www国产亚洲精品久久久日本| 精品一区二区三区免费观看| 久久精品国产99精品国产亚洲性色| 亚欧免费视频一区二区三区| 亚洲成a人片在线观看天堂无码| 内射无码专区久久亚洲| 久久国产精品免费网站| 国产日本亚洲一区二区三区| 免费人成视网站在线观看不卡| 免费在线看黄网站| 亚洲色无码专区一区| 亚洲精品偷拍视频免费观看| 久久国产精品免费网站| 麻豆亚洲AV成人无码久久精品 | 亚洲婷婷天堂在线综合| 免费v片在线观看无遮挡| 无人在线观看免费高清| 在线亚洲v日韩v| 中文字幕亚洲精品资源网|