<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级毛片无码A∨免费| 亚洲视频免费在线播放| 97性无码区免费| 亚洲精品无码你懂的| 亚洲AV无码一区二三区| av午夜福利一片免费看久久| 久久精品国产亚洲网站| 日本一区二区免费看| 亚洲成a人片在线观看中文app| 国产精品永久免费10000| 亚洲精品456人成在线| 又爽又黄无遮挡高清免费视频| 暖暖免费中文在线日本| 亚洲一区二区三区无码中文字幕| 久久综合九色综合97免费下载 | 亚洲熟妇成人精品一区| 情侣视频精品免费的国产| 日韩在线观看免费| 久久综合九九亚洲一区| 无码永久免费AV网站| 又粗又长又爽又长黄免费视频 | 美女羞羞视频免费网站| 久久精品夜色国产亚洲av| 国产无人区码卡二卡三卡免费| 青草久久精品亚洲综合专区| 国产亚洲色视频在线| 6080午夜一级毛片免费看 | 亚洲国产成人久久精品大牛影视| 亚洲高清偷拍一区二区三区 | 91亚洲精品麻豆| 波多野结衣中文一区二区免费| 三级黄色片免费看| 亚洲欧洲日韩极速播放| 在线日韩日本国产亚洲| 人妻视频一区二区三区免费| 一级女性全黄生活片免费看|