Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Advanced Serverless Architectures with Microsoft Azure

You're reading from   Advanced Serverless Architectures with Microsoft Azure Design complex serverless systems quickly with the scalability and benefits of Azure

Arrow left icon
Product type Paperback
Published in Feb 2019
Publisher Packt
ISBN-13 9781788479127
Length 278 pages
Edition 1st Edition
Languages
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Daniel Bass Daniel Bass
Author Profile Icon Daniel Bass
Daniel Bass
Arrow right icon
View More author details
Toc

Chapter 5: Observability


Activity 5: Identifying an Issue with Your Serverless Architecture

  1. Deploy the ProductsApi function app provided in the Activity 5 folder and modify the connection string in the index.html file to connect to the ProductsApi function app. Ensure that it has the Application Insights identifier on it, as shown here:

    Figure 5.17: Modify the connection string

  2. Open the Application Insights instance and navigate to the search tab. There will be a Severity level: Error log saying that the database is unavailable:

    Figure 5.18: Application Insights showing the database is unavailable

  3. Open the GetProducst.cs file in the ProductsApi folder supplied in the Activity 5 folder. There is a section of code that throws an exception at random:

    Figure 5.19: Erroneous code

  4. Remove this piece of code that is throwing the errors and deploy it. You will now no longer get issues logged to App Insights. Your repaired code should look as follows:

    Figure 5.20: Repaired code

Activity 6: Diagnosing an Issue with an Azure Durable Function

  1. Add APPINSIGHTS_INSTRUMENTATIONKEY to your Durable Function's function app's local.settings.json file if running locally, or to the Application settings page if running in the cloud from Chapter 3, Azure Durable Functions. Create and deploy a new one from Visual Studio Code if needed:

    Figure 5.21: Application Settings for the Durable Function

  2. Add the APPINSIGHTS_INSTRUMENTATIONKEY to your OrdersApi function app from Chapter 3, Azure Durable Functions. Create and deploy a new one from Visual Studio Code if needed.

  3. Go to your order.html file in the Azure Storage account and submit an order:

    Figure 5.22: order.html page

  4. Open the Application Insights instance and click on Application map. This is a really interesting view that lays out the components of your application and shows their dependencies on one another and other components. You can see some dependency issues in the screenshot, which are highlighted in red with a percentage of failed calls. This would usually be the first thing you would investigate, as it's very likely to be the cause of the issues.

    Figure 5.23: Application Map

  5. Navigate to the overview page and click on the Analytics section, as before. Look for exceptions:

    Figure 5.24: Error with Durable Function

  6. Identify the series of System.InvalidOperationException errors. Open the first one. You will see that there is a problem with retrieving the SendGrid API Key:

    Figure 5.25: Error with Durable Function

  7. The API key is present on the function app, so the reference in the code must be the error. Open the PackAndShipOrder.cs file in Visual Studio Code and observe that the SendGrid API Key name does not match the app setting name—the app setting name is called SendGridApiKey and the function is looking for an app setting called SendGridApiKey2:

    Figure 5.26: Code problem with PackAndShipOrder.cs

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image