1 00:00:00,040 --> 00:00:03,150 ‫Okay. So let's talk about the X-ray APIs 2 00:00:03,150 --> 00:00:04,990 ‫and you need to know them at a high level 3 00:00:04,990 --> 00:00:06,410 ‫and understand what they do 4 00:00:06,410 --> 00:00:08,160 ‫cause the exam may ask you to choose whether 5 00:00:08,160 --> 00:00:10,530 ‫this is the Write API for X-Ray to do something. 6 00:00:10,530 --> 00:00:12,710 ‫So let's look at the right API first 7 00:00:12,710 --> 00:00:15,260 ‫which is used by the X-Ray daemon to write data 8 00:00:15,260 --> 00:00:17,170 ‫into the X-Ray service. 9 00:00:17,170 --> 00:00:19,140 ‫So this is a managed policy 10 00:00:19,140 --> 00:00:20,910 ‫called the X-Ray Write Only Access 11 00:00:20,910 --> 00:00:23,320 ‫and you can see it has five line items 12 00:00:23,320 --> 00:00:25,610 ‫and I'm going to try to describe them to you. 13 00:00:25,610 --> 00:00:28,620 ‫So the first one is PutTraceSegments 14 00:00:28,620 --> 00:00:29,769 ‫and as the name indicates, 15 00:00:29,769 --> 00:00:33,730 ‫it uploads a segment documents into AWS X-Ray 16 00:00:33,730 --> 00:00:36,628 ‫that's necessary to have if you want to write into X-Ray. 17 00:00:36,628 --> 00:00:38,863 ‫Then we have PutTelemetryRecords 18 00:00:38,863 --> 00:00:41,020 ‫and this is for the X-Ray daemon 19 00:00:41,020 --> 00:00:43,580 ‫to upload some information about how many segments 20 00:00:43,580 --> 00:00:46,790 ‫were received, rejected and backend connection errors. 21 00:00:46,790 --> 00:00:49,290 ‫So this helps with the metrics. 22 00:00:49,290 --> 00:00:51,510 ‫Next we have a GetSamplingRules. 23 00:00:51,510 --> 00:00:54,110 ‫So usually when we write stuff, we have a lot of puts 24 00:00:54,110 --> 00:00:56,620 ‫because this was how the APIs are named in AWS 25 00:00:56,620 --> 00:00:58,260 ‫whenever you're write it says, "put." 26 00:00:58,260 --> 00:01:00,266 ‫But some half of this right API there is a get 27 00:01:00,266 --> 00:01:03,060 ‫and this one is called GetSamplingRules. 28 00:01:03,060 --> 00:01:04,600 ‫So do you know why? 29 00:01:04,600 --> 00:01:06,542 ‫Well, we saw that whenever we were changing 30 00:01:06,542 --> 00:01:09,430 ‫the sampling rules in the X-Ray console, 31 00:01:09,430 --> 00:01:12,090 ‫all the X-Ray daemons were automatically updated 32 00:01:12,090 --> 00:01:14,800 ‫to know when to send data into X-Ray. 33 00:01:14,800 --> 00:01:16,420 ‫So for your X-Ray daemon to be able to know 34 00:01:16,420 --> 00:01:18,930 ‫how the sampling rules are changing, 35 00:01:18,930 --> 00:01:22,750 ‫then the GetSamplingRule authorization and permission 36 00:01:22,750 --> 00:01:24,250 ‫is necessary. 37 00:01:24,250 --> 00:01:26,426 ‫So this also applies to GetSamplingTargets 38 00:01:26,426 --> 00:01:29,640 ‫and GetSamplingStatisticsSummaries which are advanced APIs 39 00:01:29,640 --> 00:01:32,360 ‫but are also related to the sampling rules. 40 00:01:32,360 --> 00:01:36,050 ‫So to summarize, your X-Ray demand to write into X-Ray, 41 00:01:36,050 --> 00:01:37,860 ‫it needs you have the rights to write. 42 00:01:37,860 --> 00:01:40,690 ‫So PutTraceSegments and PutTelemetryRecords 43 00:01:40,690 --> 00:01:43,230 ‫and then you should be able to get the sampling rules. 44 00:01:43,230 --> 00:01:44,980 ‫So GetSamplingRules. 45 00:01:44,980 --> 00:01:46,060 ‫Very Simple. 46 00:01:46,060 --> 00:01:48,740 ‫Now, for this API calls to work obviously, 47 00:01:48,740 --> 00:01:50,720 ‫you need you to make sure that's your X-Ray daemon 48 00:01:50,720 --> 00:01:54,770 ‫has the correct IAM policy authorizing these API calls. 49 00:01:54,770 --> 00:01:55,785 ‫So that's for the write side. 50 00:01:55,785 --> 00:01:57,680 ‫Now what about the read side? 51 00:01:57,680 --> 00:01:59,100 ‫Well, this is more complicated, 52 00:01:59,100 --> 00:02:00,722 ‫but this is a managed policy for reading. 53 00:02:00,722 --> 00:02:03,627 ‫And as you can see, all these things as says 54 00:02:03,627 --> 00:02:04,910 ‫get, get, get, get, get, 55 00:02:04,910 --> 00:02:07,150 ‫and we have one called batch get trace 56 00:02:07,150 --> 00:02:08,420 ‫which also says gets. 57 00:02:08,420 --> 00:02:12,370 ‫So GetServiceGraph is to get the main graph that we saw 58 00:02:12,370 --> 00:02:13,203 ‫in the console. 59 00:02:13,203 --> 00:02:17,330 ‫BatchGetTraces is to retrieve a list of traces specified 60 00:02:17,330 --> 00:02:19,960 ‫by ID. And each trace, as we know, is a collection 61 00:02:19,960 --> 00:02:23,350 ‫of segment documents that originates from a single request. 62 00:02:23,350 --> 00:02:26,231 ‫And then we have GetTraceSummary to receive the ID 63 00:02:26,231 --> 00:02:29,090 ‫and the annotations for traces available 64 00:02:29,090 --> 00:02:30,460 ‫for a specified time 65 00:02:30,460 --> 00:02:31,940 ‫and if he want to get the full traces 66 00:02:31,940 --> 00:02:33,890 ‫then you pass these IDs into the batch, 67 00:02:33,890 --> 00:02:37,950 ‫get traces API and finally GetTraceGraph 68 00:02:37,950 --> 00:02:40,870 ‫to retrieve a specific service graph for one 69 00:02:40,870 --> 00:02:42,970 ‫or more specific trace IDs. 70 00:02:42,970 --> 00:02:43,803 ‫So that's it. 71 00:02:43,803 --> 00:02:45,140 ‫This is all for the Read APIs 72 00:02:45,140 --> 00:02:46,950 ‫which is necessarily when you go into the console. 73 00:02:46,950 --> 00:02:48,975 ‫And so if you see these APIs at the exam, 74 00:02:48,975 --> 00:02:52,014 ‫you should be prepared to know when to use which and why. 75 00:02:52,014 --> 00:02:53,930 ‫Okay. Hope that was helpful. 76 00:02:53,930 --> 00:02:55,680 ‫I will see you in the next lecture.