We may earn an affiliate commission when you visit our partners.
Course image
Mehmet Ozkaya

When you are developing projects in microservices architecture, it is crucial to following Microservices Observability, Microservices Resilience and Monitoring principles.

Read more

When you are developing projects in microservices architecture, it is crucial to following Microservices Observability, Microservices Resilience and Monitoring principles.

So, we will separate our Microservices Cross-Cutting Concerns in 4 main pillars;

  • Microservices Observability with Distributed Logging using ElastichSearch

  • Microservices Resilience and Fault Tolerance with Appling Retry and Circuit-Breaker patterns using Polly

  • Microservices Monitoring with Health Checks using WatchDog

  • Microservices Tracing with OpenTelemetry using Zipkin

So we are going to follow this 4 main pillars and develop our microservices reference application with using latest implementation and best practices on Cloud-Native Microservices architecture style.

We have already developed this microservices reference application in the microservices course, So with this course, we will extend this microservices reference application with Cross-Cutting Concerns for provide microservices resilience.

We are going to cover;

Cross-Cutting Concerns in 4 main parts;

  • Microservices Observability with Distributed Logging,

This applying Elastic Stack which includes ElasticSearh + Logstach + Kibana and SeriLog Nuget package for .Net microservices.

We will docker-compose Kibana image from docker hub and feed Kibana with elastic stack

  • Microservices Resilience and Fault Tolerance using Polly

This will apply Retry and Circuit-Breaker Design Patterns on microservices communication with creating Polly policies.

  • Microservices Health Monitoring with using WatchDog

This will be the Aspnet Health Check implementation with custom health check methods which includes database availabilities - for example in basket microservices, we will add sub-health check conditions for connecting Redis and RabbitMQ.

  • Microservices Distributed Tracing with OpenTelemetry using Zipkin

This will be the implementation of OpenTelemetry with Zipkin.

By the end of this course, you'll learn how to design and developing Microservices Cross-Cutting Concerns - Microservices Observability with Distributed Logging, Health Monitoring, Resilient and Fault Tolerance with using Polly".

Before beginning the course, you should be familiar with C#, ASP.NET Core and Docker. This course will have good theoretical information but also will be 90% of hands-on development activities.

Enroll now

What's inside

Learning objectives

  • Microservices observability with distributed logging
  • Elastic stack which includes elasticsearh + logstach + kibana
  • Aspnet structured logs with serilog
  • Microservices resilience and fault tolerance using polly
  • Retry pattern on microservices communication
  • Circuit-breaker patterns on microservices communication
  • Microservices health monitoring with using watchdog
  • Aspnet health check implementation with custom hc methods
  • Microservices distributed tracing with opentelemetry using zipkin
  • Containerize all microservices with serilog using docker compose for logging on elasticsearch and kibana
  • Use ihttpclientfactory to implement resilient http requests
  • Implement http call retries with exponential backoff with ihttpclientfactory and polly policies
  • Apply retry pattern with polly policies on httpclientfactory for aggregator microservices
  • Apply circuit breaker pattern with polly policies on httpclientfactory for aggregator microservices
  • Using polly for database migration retries for ordering ef core sql server migration
  • Show more
  • Show less

Syllabus

Introduction

We will start a new journey with this course. You can overview the journey with following the medium articles that I shared the link with this video.

Read more
Prerequisites and Source Code

Docker Commands

docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

docker-compose -f docker-compose.yml -f docker-compose.override.yml up --build

docker-compose -f docker-compose.yml -f docker-compose.override.yml down


You can launch microservices as below urls:

  • Catalog API -> http://host.docker.internal:8000/swagger/index.html

  • Basket API -> http://host.docker.internal:8001/swagger/index.html

  • Discount API -> http://host.docker.internal:8002/swagger/index.html

  • Ordering API -> http://host.docker.internal:8004/swagger/index.html

  • Shopping.Aggregator -> http://host.docker.internal:8005/swagger/index.html

  • API Gateway -> http://host.docker.internal:8010/Catalog

  • Rabbit Management Dashboard -> http://host.docker.internal:15672 -- guest/guest

  • Portainer -> http://host.docker.internal:9000 -- admin/admin1234

  • pgAdmin PostgreSQL -> http://host.docker.internal:5050 -- [email protected]/admin1234

  • Elasticsearch -> http://host.docker.internal:9200 -- To Be Develop

  • Kibana -> http://host.docker.internal:5601 -- To Be Develop

  • Web Status -> http://host.docker.internal:8007 -- To Be Develop

  • Web UI -> http://host.docker.internal:8006

  1. Launch http://host.docker.internal:8007 in your browser to view the Web Status. Make sure that every microservices are healthy.

  2. Launch http://host.docker.internal:8006 in your browser to view the Web UI. You can use Web project in order to call microservices over API Gateway. When you checkout the basket you can follow queue record on RabbitMQ dashboard.

Microservices Observability with Distributed Logging with Elastic Stack (Elasticsearh + Logstach + Kibana and SeriLog)

Introduction - Distributed Logging with Elastic Stack (Elasticsearh + Logstach + Kibana and SeriLog)

What is Elastic Search ?
What is Kibana and SeriLog ?

Start Docker compose :

docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

docker-compose -f docker-compose.yml -f docker-compose.override.yml down

Aspnet Log Levels and Filter Logs

Adding ElasticSearch and Kibana image into Docker-Compose File for Multi-Container Docker Environment


-- Now we can add ElasticSearch and Kibana image into our docker-compose.yml files

docker-compose.yml

  elasticsearch:

    image: docker.elastic.co/elasticsearch/elasticsearch:7.9.2

  kibana:

    image: docker.elastic.co/kibana/kibana:7.9.2

volumes:

  mongo_data:

  portainer_data:

  postgres_data:

  pgadmin_data:

  elasticsearch-data:    --------------> ADDED


-- added 2 image, 1 volume

---

docker-compose.override.yml

elasticsearch:

    container_name: elasticsearch

    environment:

        - xpack.monitoring.enabled=true

        - xpack.watcher.enabled=false

        - "ES_JAVA_OPTS=-Xms512m -Xmx512m"

        - discovery.type=single-node

    ports:

        - "9200:9200"

    volumes:

        - elasticsearch-data:/usr/share/elasticsearch/data   


  kibana:

    container_name: kibana

    environment:       

        - ELASTICSEARCH_URL=http://localhost:9200

    depends_on:

        - elasticsearch

    ports:

        - "5601:5601"   


-- added elasticsearch and kibana

-- We set elasticsearch and kibana configuration as per environment variables.


Open In Terminal

RUN with below command on that location;

docker-compose -f docker-compose.yml -f docker-compose.override.yml up -d

docker-compose -f docker-compose.yml -f docker-compose.override.yml down


Go to -> AspnetRunBasics

Install Packages

Install-Package Serilog.AspNetCore

Install-Package Serilog.Enrichers.Environment

Install-Package Serilog.Sinks.Elasticsearch


Check item group project file

  <ItemGroup>

    <PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.10.9" />

    <PackageReference Include="Serilog.AspNetCore" Version="3.4.0" />

    <PackageReference Include="Serilog.Enrichers.Environment" Version="2.1.3" />

    <PackageReference Include="Serilog.Sinks.Elasticsearch" Version="8.4.1" />

  </ItemGroup>


Configure SeriLog

After that, we will configure logging in Program.cs by adding the following details on Main method.


AspnetRunBasics

Program.cs -- UseSerilog --- ADDED


public static IHostBuilder CreateHostBuilder(string[] args) =>

           Host.CreateDefaultBuilder(args)     

              .UseSerilog((context, configuration) =>

               {

                   configuration

                    .Enrich.FromLogContext()

                    .Enrich.WithMachineName()

                    .WriteTo.Console()

                    .WriteTo.Elasticsearch(

                        new ElasticsearchSinkOptions(new Uri(context.Configuration["ElasticConfiguration:Uri"]))

                        {

                            IndexFormat = $"applogs-{Assembly.GetExecutingAssembly().GetName().Name.ToLower().Replace(".", "-")}-{context.HostingEnvironment.EnvironmentName?.ToLower().Replace(".", "-")}-logs-{DateTime.UtcNow:yyyy-MM}",

                            AutoRegisterTemplate = true,

                            NumberOfShards = 2,

                            NumberOfReplicas = 1

                        })

                    .Enrich.WithProperty("Environment", context.HostingEnvironment.EnvironmentName)

                    .ReadFrom.Configuration(context.Configuration);

               })

               .ConfigureWebHostDefaults(webBuilder =>

               {

                   webBuilder.UseStartup<Startup>();

               });


-- We have configured Serilog according to writing Console and Elastic Search. When Configure for the Elastic Search we provide some sink options.


Test SeriLog For ElasticSearch and Kibana Sink Integration in Shopping Web Microservices

Create SeriLog Common Logging Library For ElasticSearch and Kibana Sink Integration to All Microservices

Adding SeriLog Common Logging Library Project References to Aspnetrun Shopping Web Application

Adding LoggingDelegatingHandler for Intercepting Microservices Request-Response Logging on ElasticSearch and Kibana

Adding SeriLog for Shopping.Aggregator Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for Catalog.API Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for Basket.API Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for Discount.API Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for Discount.Grpc Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for Ordering.API Microservices for Logging on ElasticSearch and Kibana

Adding SeriLog for OcelotApiGw Microservices for Logging on ElasticSearch and Kibana

Containerize All Microservices with SeriLog using Docker Compose for Logging on ElasticSearch and Kibana

Containerize All Microservices with SeriLog using Docker Compose for Logging on ElasticSearch and Kibana Part 2

Test on Docker environment - SeriLog Microservices into Docker Compose for Logging on ElasticSearch and Kibana

Observability and Logging Quiz
Microservices Resilience and Fault Tolerance using Polly
Introduction - Microservices Resilience and Fault Tolerance with using Polly
Microservices Resilience Patterns
Retry pattern
Circuit breaker pattern
Bulkhead Pattern

Apply Retry Pattern with Polly policies on HttpClientFactory for Shopping.Aggregator Microservices

Apply Circuit Breaker Pattern with Polly policies on HttpClientFactory for Shopping.Aggregator Microservices

Develop Advance Policies for Retry and Circuit Breaker Pattern with Polly policies on HttpClientFactory

Nuget Package

Install-Package Microsoft.Extensions.Http.Polly

See that

<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="5.0.1" />

Apply Policies for Retry and Circuit Breaker Pattern with Polly policies for AspnetRun Shopping Microservices

Nuget Package

Install-Package Microsoft.Extensions.Http.Polly

See that

<PackageReference Include="Microsoft.Extensions.Http.Polly" Version="5.0.1" />

Using Polly for Database Migration Retries for Ordering.API EF.Core Sql Server Migration

Using Polly for Database Migration Retries for Discount.API/Grpc Dapper PostgreSQL Migration

Microservices Health Monitoring with using WatchDog
Introduction - Microservices Health Monitoring with using WatchDog
Asp.Net Health Checks

Nuget Package

Install-Package Microsoft.AspNetCore.Diagnostics.HealthChecks


Adding json response

Nuget Package

Install-Package AspNetCore.HealthChecks.UI.Client


Startup.cs -> Configure

app.UseEndpoints(endpoints =>

            {

                endpoints.MapControllers();               

                endpoints.MapHealthChecks("/hc", new HealthCheckOptions()

                {

                    Predicate = _ => true,

                    ResponseWriter = UIResponseWriter.WriteHealthCheckUIResponse

                });

            });

Adding Health Check for Basket.API Microservices with Checking Redis and RabbitMQ Connection

Adding Health Check for Discount Microservices with Checking PostgreSQL Connect

Adding Health Check for Ordering.API Microservices with Checking Sql Server and RabbitMQ Connection

Adding Health Check for Shopping.Aggregator Microservices with Checking Internal Microservices Integrations

Adding Health Check for AspnetRunBasics Shopping Microservices with Checking Ocelot ApiGw Integrations

Developing WebStatus App for Centralized Microservices Health Monitoring Using Watchdogs for Visualization

Developing WebStatus App for Centralized Microservices Health Monitoring Using Watchdogs for Visualization Part 2

appsettings.json file

"HealthChecks-UI": {

    "HealthChecks": [

      {

        "Name": "Catalog Health Check",

        "Uri": "http://localhost:8000/hc"

      },

      {

        "Name": "Basket Health Check",

        "Uri": "http://localhost:8001/hc"

      },

      {

        "Name": "Discount Health Check",

        "Uri": "http://localhost:8002/hc"

      },

      {

        "Name": "Ordering Health Check",

        "Uri": "http://localhost:8004/hc"

      },

      {

        "Name": "Shopping Aggregator Health Check",

        "Uri": "http://localhost:8005/hc"

      },

      {

        "Name": "AspnetRunBasics WebMVC Health Check",

        "Uri": "http://localhost:8006/hc"

      }

    ],

Containerize WebStatus Health Monitoring Microservices using Docker Compose

Test All Microservices on Docker environment - WebStatus Health Monitoring Microservices into Docker Compose for Visulize WatchDog HC

Microservices Distributed Tracing with OpenTelemetry using Zipkin
Introduction - Distributed Tracing with OpenTelemetry using Zipkin

Thanks Mohammed Mansoor for developing this assignment. He developed the distributed tracing with OpenTelemetry but I used Jaeger as a tracing tool.

See Codes on Github -> https://github.com/mansoorafzal/AspnetMicroservices

See Thread in Q&A -> https://www.udemy.com/course/microservices-observability-resilience-monitoring-on-net/learn/#questions/15889908/




Thanks
Bonus Lecture

Good to know

Know what's good
, what to watch for
, and possible dealbreakers
Develops Distributed Logging, Microservices Resilience, Monitoring with Health Check, and Distributed Tracing with OpenTelemetry using Zipkin which are core skills for Cloud Native Microservices architecture development
Taught by Mehmet Ozkaya who is recognized for their work in Microservices Observability, Microservices Resilience and Monitoring
Explores industry standard logging ElasticSearch + Logstash + Kibana and Serilog for logging
Examines Polly for Microservices Resilience and Fault Tolerance
Builds a strong foundation for beginners in Microservices Observability, Microservices Resilience, Monitoring, and Tracing with OpenTelemetry using Zipkin

Save this course

Save Microservices Observability, Resilience, Monitoring on .Net to your list so you can find it easily later:
Save

Activities

Be better prepared before your course. Deepen your understanding during and after it. Supplement your coursework and achieve mastery of the topics covered in Microservices Observability, Resilience, Monitoring on .Net with these activities:
Attend a Microservices Meetup
Attend a local microservices meetup to connect with other professionals, learn about industry trends, and ask questions.
Browse courses on Networking
Show steps
  • Find a local microservices meetup
  • Attend the meetup
  • Network with other attendees
Participate in a Microservices Workshop
Attend a microservices workshop to gain hands-on experience in designing, developing, and deploying microservices, using industry best practices and tools.
Show steps
  • Find a microservices workshop
  • Attend the workshop
  • Complete the hands-on exercises
  • Ask questions and interact with experts
Design a Fault Tolerance Mechanism
Create a fault tolerance mechanism for a microservice, such as a retry mechanism or circuit breaker, to improve system availability.
Browse courses on Fault Tolerance
Show steps
  • Identify potential failure scenarios
  • Design a fault tolerance strategy
  • Implement the fault tolerance mechanism
  • Test and evaluate the fault tolerance mechanism
Three other activities
Expand to see all activities and additional details
Show all six activities
Explore OpenTelemetry
Explore the OpenTelemetry framework for distributed tracing and logging in microservices, including its components and how to use it in a real-world application.
Browse courses on OpenTelemetry
Show steps
  • Install and configure OpenTelemetry
  • Create traces and logs
  • Visualize and analyze traces and logs
Contribute to an Open Source Microservices Project
Contribute to an open source microservices project, such as Kubernetes or Istio, to gain practical experience and learn from experts in the field.
Browse courses on Community Involvement
Show steps
  • Find an open source microservices project
  • Identify an area to contribute
  • Submit a pull request
  • Review code and provide feedback
Build a Microservices Prototype
Build a small-scale microservices prototype to apply the concepts and techniques learned in the course, such as creating services, handling communication, and implementing monitoring.
Show steps
  • Design the microservices architecture
  • Implement the microservices
  • Deploy and test the prototype
  • Monitor and troubleshoot the prototype

Career center

Learners who complete Microservices Observability, Resilience, Monitoring on .Net will develop knowledge and skills that may be useful to these careers:
Software Engineer
As a Software Engineer, you'll design, develop, and test software systems. This role often involves working with Microservices and other advanced software engineering concepts. The course you're taking dives deep into the topics and skills necessary for success as a Software Engineer. In particular, the course will provide you with hand-on training on how to implement Microservices Observability, Resilience and Monitoring on .Net, some of the most popular frameworks in enterprise software development today.
Cloud Architect
Cloud Architects design and manage cloud computing systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking dives deep into the topics and skills necessary for success as a Cloud Architect. In particular, the course will help you build a strong foundation in Microservices Observability, Resilience and Monitoring on .Net.
DevOps Engineer
DevOps Engineers bridge the gap between development and operations teams. They ensure that software is developed and deployed efficiently and reliably. The course you're taking covers topics such as Microservices Observability, Resilience and Monitoring on .Net. These topics are essential for DevOps Engineers who want to be able to monitor and troubleshoot software systems.
Data Engineer
Data Engineers design and build systems for managing and analyzing data. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a strong foundation in the principles of Microservices Observability, Resilience and Monitoring on .Net, skills necessary for success in a Data Engineer role.
Software Architect
Software Architects design and develop software systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking covers topics such as Microservices Observability, Resilience and Monitoring on .Net. These topics will help you to develop the skills you need to succeed as a Software Architect
Full-Stack Developer
Full Stack Developers are responsible for both the front-end and back-end of software systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a solid foundation in these topics, which will help you to succeed as a Full Stack Developer.
Backend Developer
Backend Developers are responsible for the back-end of software systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking covers topics such as Microservices Observability, Resilience and Monitoring on .Net, which will help you succeed as a Backend Developer.
Front-End Developer
Front End Developers are responsible for the front-end of software systems. While this role may not directly involve all of the concepts covered in the Microservices Observability, Resilience and Monitoring on .Net course, it may still be useful for Front End Developers who want to gain a better understanding of how these concepts can impact their work.
Quality Assurance Analyst
Quality Assurance Analysts are responsible for testing software systems to ensure that they meet quality standards. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a solid foundation in these topics, which will help you to succeed as a Quality Assurance Analyst.
Product Manager
Product Managers are responsible for the development and launch of software products. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for Product Managers who want to gain a better understanding of the technical aspects of software development.
Technical Writer
Technical Writers are responsible for creating documentation for software systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for Technical Writers who want to gain a better understanding of the technical aspects of software development.
IT Consultant
IT Consultants provide advice and guidance on information technology systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for IT Consultants who want to gain a better understanding of the technical aspects of software development.
IT Manager
IT Managers are responsible for the management of information technology systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for IT Managers who want to gain a better understanding of the technical aspects of software development.
Systems Analyst
Systems Analysts are responsible for the analysis and design of software systems. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for Systems Analysts who want to gain a better understanding of the technical aspects of software development.
Business Analyst
Business Analysts are responsible for the analysis of business processes and requirements. This often involves working with Microservices and other advanced software engineering concepts. The course you're taking will provide you with a basic understanding of these topics, which may be useful for Business Analysts who want to gain a better understanding of the technical aspects of software development.

Reading list

We've selected seven books that we think will supplement your learning. Use these to develop background knowledge, enrich your coursework, and gain a deeper understanding of the topics covered in Microservices Observability, Resilience, Monitoring on .Net.
A comprehensive guide to designing, deploying, and managing microservices architectures. It provides a solid foundation for understanding the concepts and practices of microservices.
A collection of patterns and practices for designing and implementing microservices. It provides guidance on how to solve common challenges in microservices development.
A practical guide to building and deploying microservices. It covers topics such as service discovery, load balancing, and API gateways.
A comprehensive guide to microservices. It covers topics such as microservices architecture, design patterns, and best practices.
A collection of patterns and practices for designing and implementing microservices. It provides guidance on how to solve common challenges in microservices development.
Provides a comprehensive guide to DevOps. It covers topics such as DevOps culture, tools, and best practices. This book valuable resource for anyone who wants to learn more about DevOps.
Provides a comprehensive guide to building and extending the Kubernetes API using Operators. It covers topics such as Operator design, development, and deployment. This book valuable resource for anyone who wants to learn more about Kubernetes Operators.

Share

Help others find this course page by sharing it with your friends and followers:

Similar courses

Here are nine courses similar to Microservices Observability, Resilience, Monitoring on .Net.
Observability with OpenTelemetry and Grafana
Most relevant
Node.js Microservices: Monitoring and Logging
Most relevant
Observability with Grafana, Prometheus,Loki, Alloy and...
Most relevant
Observability in Cloud Native apps using OpenTelemetry
Most relevant
Monitoring and Observability for Application Developers
Most relevant
Node.js Microservices: Resilience and Fault Tolerance
Most relevant
Creating .Net Core Microservices using Clean Architecture
Most relevant
Monitoring and Observability for Development and DevOps
Most relevant
Design Microservices Architecture with Patterns &...
Most relevant
Our mission

OpenCourser helps millions of learners each year. People visit us to learn workspace skills, ace their exams, and nurture their curiosity.

Our extensive catalog contains over 50,000 courses and twice as many books. Browse by search, by topic, or even by career interests. We'll match you to the right resources quickly.

Find this site helpful? Tell a friend about us.

Affiliate disclosure

We're supported by our community of learners. When you purchase or subscribe to courses and programs or purchase books, we may earn a commission from our partners.

Your purchases help us maintain our catalog and keep our servers humming without ads.

Thank you for supporting OpenCourser.

© 2016 - 2024 OpenCourser