Pages

Friday, November 24, 2023

Complete setup guide of Elasticsearch, Kibana and APM Server with .NET Agent

Observability is a crucial part of any software product, it helps in understanding the internal state of a system by collecting and analyzing metrics, logs, and traces. This information can be used to troubleshoot issues, identify performance bottlenecks, and make improvements to the system.
Observability is especially important for complex systems, such as distributed systems, where it is difficult to track down the root cause of problems.

There exist several tools out there to help monitor your system's health. Assuming you have an instrumented system, how could you visualize this instrumentation information, and get real-time updates on your system performance?

The topic of observability is divergent and can be spanned across many posts.
But in this post, I chose one topic that posed a tough challenge to me, and that is setting up the APM Server of Elasticsearch, given how scattered their documentation is, and the lack of community support, the challenge was real, hopefully for someone trying to fi I'm going to set up the Elastic APM Server, one of the popular tools to analyze metrics.

Let's get straight to it...

Setting up Elasticsearch

First, create an Elasticsearch container:
docker run --name es01 --net elastic -p 9200:9200 -it -m 1GB docker.elastic.co/elasticsearch/elasticsearch:8.10.4

ToFor information, please refer to: 
https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html#_start_a_single_node_cluster

Run this command, and make sure the container es01 is running:
docker ps


For Rancher Desktop Users

If you are using Rancher Desktop instead of Docker Desktop, you might face this problem:
If the container has stopped unexpectedly (please use docker logs es01  to inspect the reason), you may see this error:
node validation exception\n[1] bootstrap checks failed. 
      You must address the points described in the following [1] lines before starting Elasticsearch.\n
      bootstrap check failure [1] of [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]", "ecs.version"
To fix, enter Rancher Desktop shell:
rdctl shell

Then run this command:
sysctl -w vm.max_map_count=262144

To exit the shell, run:
exit

Then restart Rancher Desktop (make sure Rancher Desktop GUI is activated):
rdctl shutdown
rdctl start

How to do code reviews correctly

Introduction Code review is a special event in the life cycle of software development, it's where ownership is transferred from the deve...