1 00:00:00,130 --> 00:00:01,940 ‫So this is a very short hands-on 2 00:00:01,940 --> 00:00:04,580 ‫but I'm going to show you the sampling rules in X-Ray. 3 00:00:04,580 --> 00:00:07,270 ‫So on the left-hand side of X-ray you get sampling, 4 00:00:07,270 --> 00:00:09,110 ‫and then you have access to all the sampling rules. 5 00:00:09,110 --> 00:00:11,290 ‫As we can see we can define many sampling rules 6 00:00:11,290 --> 00:00:12,700 ‫with different priorities. 7 00:00:12,700 --> 00:00:15,970 ‫And so if we look at the default sampling rule here 8 00:00:15,970 --> 00:00:17,650 ‫the priority is high 9 00:00:17,650 --> 00:00:19,930 ‫and what we get is a reservoir size 10 00:00:19,930 --> 00:00:23,280 ‫of one request per second and a fixed rate of five percent. 11 00:00:23,280 --> 00:00:26,010 ‫In any case you forget, there is a description here 12 00:00:26,010 --> 00:00:27,600 ‫as well as an information button 13 00:00:27,600 --> 00:00:29,480 ‫that tells you how to fix these limits. 14 00:00:29,480 --> 00:00:31,760 ‫And in the matching criteria it's a bit more advanced 15 00:00:31,760 --> 00:00:32,593 ‫for your sampling rules. 16 00:00:32,593 --> 00:00:34,100 ‫But this matches everything. 17 00:00:34,100 --> 00:00:37,450 ‫So every service, every service type, every method for HTTP. 18 00:00:37,450 --> 00:00:40,520 ‫Any URL, any resource ARN and any host. 19 00:00:40,520 --> 00:00:42,240 ‫And you can cancel this 20 00:00:42,240 --> 00:00:43,970 ‫and you can create your own sampling rule. 21 00:00:43,970 --> 00:00:45,420 ‫So I can call it DemoSampling 22 00:00:46,620 --> 00:00:48,890 ‫and give it priority five thousand. 23 00:00:48,890 --> 00:00:51,680 ‫And if you go here it says that the lower priority 24 00:00:51,680 --> 00:00:53,150 ‫takes precedence in the order. 25 00:00:53,150 --> 00:00:55,310 ‫So this will be a better rule 26 00:00:55,310 --> 00:00:56,480 ‫that would be applied first. 27 00:00:56,480 --> 00:00:59,390 ‫And we can say a reservoir size is ten requests per second 28 00:00:59,390 --> 00:01:00,460 ‫so more requests. 29 00:01:00,460 --> 00:01:02,870 ‫And there'd be a fixed rate of one percent 30 00:01:02,870 --> 00:01:04,710 ‫because we want less requests afterwards. 31 00:01:04,710 --> 00:01:07,850 ‫It's up to you do your reservoir and your fixed rate 32 00:01:07,850 --> 00:01:11,660 ‫as you want based on your application requirements. 33 00:01:11,660 --> 00:01:14,100 ‫The cool thing here is that we can drill down 34 00:01:14,100 --> 00:01:15,440 ‫for service or service type. 35 00:01:15,440 --> 00:01:17,610 ‫So if you're just interested not all the services 36 00:01:17,610 --> 00:01:20,650 ‫but one service in particular and want to debug it. 37 00:01:20,650 --> 00:01:22,570 ‫Maybe you want to have a reservoir size as one 38 00:01:22,570 --> 00:01:24,800 ‫and a fixed rate of one hundred percent. 39 00:01:24,800 --> 00:01:27,990 ‫And what this will do is that if you specify my service 40 00:01:27,990 --> 00:01:29,670 ‫and create this rule, what this will do 41 00:01:29,670 --> 00:01:32,380 ‫is that this service, my service, will send all it's traces 42 00:01:32,380 --> 00:01:33,350 ‫into X-Ray. 43 00:01:33,350 --> 00:01:35,950 ‫So it can really debug what's happening for my service 44 00:01:35,950 --> 00:01:37,000 ‫in details. 45 00:01:37,000 --> 00:01:39,530 ‫But you could also filter by HTTP method, so for example 46 00:01:39,530 --> 00:01:43,430 ‫just for post and the path of the URL, the host, the ARN. 47 00:01:43,430 --> 00:01:45,871 ‫So you're really free to create sampling rules 48 00:01:45,871 --> 00:01:47,410 ‫and then go ahead. 49 00:01:47,410 --> 00:01:49,890 ‫And as I said once you create a sampling rule 50 00:01:49,890 --> 00:01:52,910 ‫it will be applied automatically to all your X-Ray daemons 51 00:01:52,910 --> 00:01:55,800 ‫and so you don't need to worry about restarting your code. 52 00:01:55,800 --> 00:01:58,550 ‫And that makes X-Ray a very very flexible service 53 00:01:58,550 --> 00:01:59,890 ‫and one that you should be using 54 00:01:59,890 --> 00:02:02,330 ‫if you're running distributed services. 55 00:02:02,330 --> 00:02:03,400 ‫So I hope that was helpful, 56 00:02:03,400 --> 00:02:05,350 ‫and I will see you in the next lecture.