Detailed explanation Monitoring & performance improvement with NewRelic-Part 2

Overview

Continuing from the previous session. I changed the title. Part 2, but the case number starts with 1.

Detailed explanation NewRelic monitoring & performance improvement-Part 1 Detailed explanation NewRelic monitoring & performance improvement-Part 2

Case 1: I want to know if the application is working properly

It is a survival confirmation. If you try to do it right, you can make a request to a set of APIs and check the response. However, in reality, it is not necessary to do so, and I think that you can check whether the response is correct by throwing whether the application is running or not to one API for survival confirmation. At that time, what kind of API is created is important. Instead of just returning echo like the echo server, it is good to make a light query to connected services such as MySQL and Redis. By doing so, you can also check the existence of MySQL and Redis at the same time.

In New Relic, you can set it as follows.

ping_1.png

After setting, you can see the result in Availability.

ping_2.png

You can also set Alert mail etc., so if you set it, you can quickly notice when the system goes down. In the team to which you belong, you will be notified in the chat when the development environment becomes unreachable, so you can quickly notice and correct it.

Case 2: I want to know the response time from all over the world

The apps that are deployed worldwide depend on the response time from each country. In New Relic, you can check the response time from the following regions by setting SYNTHETICS. It will be sent at regular intervals.

synthetics_1.png synthetics_2.png

Case 3: I want to know the player ID when an exception occurs

In New Relic, the exceptions that occur are displayed in Errors, but they don't contain application-specific information unless you set them yourself. For example, if something that can identify a user such as player_id is recorded with an exception, you can search for that user from the application management screen etc. and find out more detailed status of the exception.

If you set it correctly in New Relic, it looks like the following.

custome_attribute.png

It is set as follows on the source code. It's a common process, so it seems that it will make you feel good if you put it in the pre-process of decorator or view. (Story on Django)

Add player_id to #newrelic newrelic.agent.add_custom_parameter('player_id', player.id)

Case 4: I've improved an API so I want to see if it's actually faster

If it improves, it is meaningless unless you measure it and check if it is actually faster. You can also check that area with New Relic.

historical_performance.png

Conclusion

Last time, I said that I would like to introduce Key Transactions, X-Ray, but if I introduced other ones, the time has expired, so I will do it next time. Next time, I will introduce Key Transactions, X-Ray from the beginning.

Recommended Posts

Detailed explanation Monitoring & performance improvement with NewRelic-Part 2
Detailed explanation Monitoring & performance improvement with NewRelic-Part 1
Detailed explanation Performance improvement with NewRelic-Part 3
Winning with Monitoring
Performance improvement efforts