TechWriterDev
  • Cloud
    • AWS
      • 00_Doubts
      • CloudPractitioner
        • Cloud Computing
        • AWS Global Infrastructure
        • Introduction to AWS EC2
        • Elastic load balancer(ELB)
        • 04_Messaging_Queuing
        • Aditional Computing Service
        • Accessing AWS resources
        • AWS Networking
        • Storage
        • Amazon Database Solutions
        • Monitoring Tools
        • AWS Security
        • Distributed Denial Of Service Attacks
      • DeveloperAssociate
        • References
        • AWS DVA-C02 Services Index
        • Services
          • 00_IAM
            • Identity and Access Management (IAM)
            • Account Protection Mechanisms
            • Access Mechanism of AWS Resources
            • Security Tools
            • Responsibility Model
            • Advanced Concepts
          • 01_EC2
            • Elastic Compute Cloud (EC2)
            • EC2 Volume Types
            • Amazon Machine Image (AMI)
            • AWS charges for IPv4 address
          • 02_SecurityGroups
            • Security Groups
          • 03_Elastic_LoadBalancing
            • Terminology
            • Elastic load balancer
            • Features
            • Basics
          • 04_AutoScaling
            • Auto Scaling
          • 05_RDS
            • Relational Database Service (RDS)
            • Aurora
            • Security
            • RDS Proxy
          • 06_ElastiCache
            • Cache
            • Cache Offerings
          • 07_Route53
            • Basics of DNS
            • Route 53
          • 08_VPC
            • Virtual Private Cloud (VPC)
          • 09_S3
            • Simple Storage Service (S3)
            • S3 Features
            • S3 Encryption
            • S3 Features
            • S3 Bucket Policy and IAM Policy
          • 10_ECS
            • Elastic Container Service (ECS)
            • Elastic Container Registry (ECR)
            • AWS Copilot
          • 11_EKS
            • Elastic Kubernetes Service (EKS)
          • 12_SDK_CLI_Tips
            • Access AWS Resources
          • 13_CloudFront
            • Cloud Front
          • 14_Messaging
            • Simple Queue Service (SQS)
            • Simple Notification Service (SNS)
            • Fan Out Pattern
            • Kinesis
            • Compare and Contrast
          • 15_ElasticBeanStalk
            • Elastic Beanstalk
          • 16_CloudFormation
            • CloudFormation
            • Dynamic References
          • 17_Monitoring
            • AWS Monitoring
            • AWS CloudWatch
            • CloudWatch Alarms
            • Synthetics Canary
            • Amazon EventBridge (formerly CloudWatch Events)
            • X-Ray
            • OpenTelemetry
            • CloudTrail
          • 18_Lambda
            • Lambda
            • Lambda Integrations
            • Configuring Lambda
            • Lambda Layers
          • 19_API_Gateway
            • API Gateway
            • API Gateway Integrations
          • 20_DynamoDB
            • DynamoDB
            • Operations
            • Indexes
            • DynamoDB Accelerator (DAX)
            • DynamoDB Streams
            • Transactions
            • Integrations
          • 21_CICD
            • CICD
            • CodeCommit
            • CodePipeline
            • CodeBuild
            • CodeDeploy
            • CodeArtifact
            • CloudGuru
          • 22_SAM
            • Serverless Application Model (SAM)
          • 23_CDK
            • Cloud Development Kit (CDK)
          • 24_StepFunctions
            • Step Functions
            • Types of step function
          • 25_AppSync
            • AppSync
          • 26_Amplify
            • Amplify
          • 27_STS
            • Security Token Service (STS)
          • 28_DirectoryService
            • Active Directory
          • 29_KMS
            • Encryption
            • KMS API
            • Features
            • Cloud Hardware Security Module (HSM)
          • 30_SSM_Store
            • SSM Parameter Store
          • 31_SecretsManager
            • Secrets Manager
          • 32_Cognito
            • Cognito
      • Questions
        • AWS_Region
        • EC2
        • IAM
  • Database
    • MongoDb
      • Mongo db Basics
      • Mongo DB Atlas
      • Document
      • Import-Export based on Data Format
      • Mongo Shell Commands
      • Query Operators
      • Indexes
      • Upsert
      • MongoDB Aggregation Framework
      • Aggregation Framework Operators
    • PostgreSQL
      • POSTGRE SQL DataTypes
      • About table
      • Constraints
  • Technologies
    • RabbitMQ
      • RabbitMQ Concepts
      • Introduction to Exchanges
      • Introduction to Queues
    • Terraform
      • 00_Introduction
      • Configuration blocks
      • Commands
      • Variables
      • Terraform Cloud
      • Modules
  • Languages
    • Java
      • Logging
        • Getting Started
      • 00_Core
        • 00_Basics
          • Java Vs C++
          • Object oriented principles
          • Steps to compile a java program
          • JVM Internals
          • Understanding Java Development Kit
          • What is JIT Compiler?
          • Java data types
          • 07_identifiers_type_conversion
          • 08_references_and_packages
          • Steps for attaching scanner
        • Concurrency
          • 00_Threads
            • Threads
          • 01_ExecutorFramework
            • Executor Framework
            • Asynchronous Computation
      • 01_Backend
        • 01_HttpAndWebServerBasics
          • HTTP
          • Content Type
          • Web Server
        • 02_J2EE_Basics
          • J2EE_Basics
          • Why HttpServlet classs is declared as abstract class BUT with 100 % concrete functionality ?
        • 03_TomCatAndSession
          • What is a Session?
          • WebContainer
        • 04_PageNavigation
          • Cookies Additional Information
          • Page Navigation Techniques
        • 05_AboutServlet
          • CGI v/s Servlet
          • Executor Framework
          • Servlet Life cycle
          • SERVLET CONFIG
          • Servlet Context
          • Servlet Listener (web application listener)
        • 08_SpringBoot
          • Spring Boot
          • Some common annotations used in spring eco system
        • 09_SpringDataJPA
          • Spring Data JPA
        • Java_Language_Changes
          • JDK enhancement tracking reference
        • 06_ORM_Hibernate
          • readmes
            • Hibernate
            • Advantages of Hibernate
            • Hibernate Caching
            • Hibernate API
            • Hibernate Query API
            • Hibernate Annotations and JPQL
            • Entity and Value Type
        • 07_SpringFramework
          • bean_validation
            • Bean Validation
          • core
            • readme
              • Spring
              • Spring Framework Modules
              • Spring MVC Request flow
              • Dependency Injection
              • Spring Beans
              • 06_Spring_Framework_Annotations
      • 03_Tools
        • Maven
          • Maven
  • SoftwareEngineering
    • DesignPatterns
      • Notes
        • Basics
        • OOP
        • SOLID Principles
        • 03_Creational
          • Abstract Factory (aka Kit)
          • Builder
          • Factory Method (aka Virtual constructor)
          • Prototype
          • Singleton
        • 04_Structural
          • Adapter (aka Wrapper)
          • Bridge (aka Handle | Body)
          • Composite
          • Decorator (aka Wrapper)
          • Facade
          • Flyweight
          • Proxy (aka Surrogate)
        • 05_Behavioral
          • Chain of Responsibility
          • Command (aka Action | Transaction)
          • Iterator (aka Cursor)
          • Observer (aka Publish-Subscribe | Dependents)
          • Strategy (aka Policy)
    • Principles
      • REST
        • REST
  • Tools
    • Containers
      • Docker
        • Docker
        • Docker Image
        • Commands
        • Compose
        • Best Practices
      • Kubernetes
        • Kubernetes
    • VCS
      • Git
        • Quick reference of useful Git commands
Powered by GitBook
On this page
  • Icon
  • About
  • Compatibility
  • Working
  • Enable X-Ray
  • X-Ray Instrumentation
  • X-Ray Concepts
  • X-Ray Daemon
  • X-Ray APIs
  • ECS and X-Ray
  1. Cloud
  2. AWS
  3. DeveloperAssociate
  4. Services
  5. 17_Monitoring

X-Ray

PreviousAmazon EventBridge (formerly CloudWatch Events)NextOpenTelemetry

Last updated 4 months ago

Icon

XRay

About

  • X-Ray is an AWS offering which allows to in the following

    • Troubleshoot performance.

    • Understand dependencies in microservices architecture.

    • Review request behavior.

    • Find errors and exceptions.

    • SLA requirements can be accessed.

    • Throttling issues.

    • Identify users that are impacted

  • X-Ray service map gives details about the api flow, service interaction in a nice graphical visual form, giving interesting insights.

Compatibility

  • Can be used along with many AWS services

    • Lambda

    • Elastic Beanstalk

    • ECS

    • ELB

    • API Gateway

    • EC2 instances or any application server (even on premise)

Working

  • X-Ray leverages tracing

  • Tracing is a end to end way of following a request.

  • Each component dealing with the request adds its own trace.

  • Tracing is made of segments.

  • Annotations can be added to trace to provide extra-information

  • Ability to trace

    • Every request

    • Sample request (as a % for example or a rate per minute)

  • X-Ray Security

    • IAM Authorization

    • KMS for encryption at rest

Enable X-Ray

  • To enable X-Ray, one must import the AWS X-Ray SDK.

  • Install X-Ray daemon or enable X-Ray AWS integration in the AWS service.

  • All application should have IAM rights to write data to X-Ray.

  • Once all the above is done, X-Ray daemon will send batch every 1 second to AWS X-Ray.

  • For lambda, X-Ray Active Tracing should be enabled in lambda function's configuration.

X-Ray Instrumentation

  • Instrumentation means the measure of product's performance, diagnose errors, and to write trace information.

  • To instrument your application code, use the X-Ray SDK.

  • Mostly configuration changes are only required, however one can modify the application using interceptors, filters, handlers etc.

X-Ray Concepts

  • Segments

    • Each application/service will send them.

  • Sub Segments

    • To provide more fine grain details in your segment.

  • Trace

    • Segments collected together to form an end-to-end trace.

  • Sampling

    • To decrease the amount of requests send to X-Ray, reduce cost.

    • It allows to control the amount of data that you record.

    • Sampling rules can be modified without changing code.

    • By default, the X-Ray SDK records the first request each second and five percent of additional requests.

    • One request per second is the reservoir, which ensures that atleast one trace is recorded each second as long as the service is serving requests.

    • Five percent is the rate at which additional requests beyond the reservoir are sampled.

    • One can define their own sampling rules, along with reservoir and rate.

  • Annotations

    • These are key-value pairs to index traces and use the filters.

  • Metadata

    • Key-Value pairs, not indexed, not used for searching

X-Ray Daemon

  • X-Ray daemon/agent has a config to send traces cross-account. - Make sure the IAM permissions are correct. The agent will assume the role.

  • This allows to have central account for application tracing.

X-Ray APIs

  • PutTraceSegments: Upload segment documents to AWS X-Ray

  • PutTelemetryRecords: Used by the AWS X-Ray daemon to upload the telemetry.

  • GetSamplingRules: Retrieving all sampling rules.

  • GetServiceGraph: Retrieves main graph

  • BatchGetTraces: Retrieve a list of traces specified by ID. Each trace is a collection of segment documents that originates from a single request.

  • GetTraceSummaries: Retrieve IDs and annotations for traces available for specified time frame using optional filter. To get full traces, pass the trace IDs to BatchGetTraces.

  • GetTraceGraph: Retrieves a service graph for one or more specific trace IDs.

  • X-Ray Daemon should have an IAM policy authorizing so that for the above API calls to retrieve the details.

ECS and X-Ray

  • EC2 instance : X-Ray Container as Daemon

    • Application container will run along with this daemon container per EC2 instance.

    • X-Ray container will run alongside application container.

    • Both will connect to each other from networking context.

  • ECS Fargate cluster

    • Similar to ECS cluster, the fargate task will have both the app container and X-Ray SideCar Container.

ECS cluster : X-Ray Container as

SideCar pattern