azure-functions-university
azure-functions-university copied to clipboard
Content Request: Logging & monitoring functions
š Lesson Description
Provide a clear and concise description of the content you'd like to have included.
Logging & Monitoring Azure Functions is a very important aspect of running successful functions in production. In this lesson the following should be covered:
- Application Insights basics
- What is logged by default
- Using application logging in your Azure Functions. (
ILoggerandILogger<T>) - Useful queries in Log Analytics
Are you authoring the lesson?
ā Indicate if you want to (help) write the lesson.
YES, but I'd like a co-author for this lesson.
š©āš« If you are authoring then indicate if you want to join our live stream to help teach this lesson.
YES, but I'd like a co-host for this lesson.
Thanks! š That's all we need to know for now. If you're interested in writing the lesson yourself please read the Process and Lesson Structure parts below so you're well prepared! šŖ
Process
If you are contributing to create a lesson, please take into account the length and the tone of the existing lessons. We want to have a uniform experience across all of our lessons.
Once we've discussed this issue and agree to include the lesson you can submit a PR with the lesson and the source code. It will probably take a few iterations to get everything right, don't feel discouraged by this process ā„.
Lesson Structure
Please keep in mind the following structure of a lesson:
- Give the lesson a short but descriptive title.
- Describe the goal of the lesson.
- Break up the lesson in small exercises.
- Each exercise has a clear sub goal and steps how to achieve that sub goal.
- Use code samples and plenty of š, š and ā call-outs.
- Add a new project to the
srcfolder with a completely worked out example.
@madebygps I've created this branch for us to work in: https://github.com/marcduiker/azure-functions-university/tree/add-logging-dotnet31
@madebygps @marcduiker Iām not sure what is the status of this content request.
For the record, I have material for lesson that covers the following topics:
- Basics of Logging (severity levels, configuration with
host.json) - Structured logging in Application Insights (customizing event id, event name, including key/value pairs to logs, in addition to a string message)
- Supporting W3C distributed tracing with additionnal properties like
TraceId,ParentIdandSpanId.
Please, let me know if any of those things may be of interest.
Hi @springcomp, we didn't have any capability to record lessons lately but if you have material than I'm happy record a session with you. Let's make sure there is a PR first with the written lesson. Something under dotnet6/AzFuncUni.Logging assuming that is dotnet6.
Hello @marcduiker Iām making some progress but before I get too carried away, would you be so kind as to provide superficial feedback. Maybe just look at the rough outline and tell me if that goes into the general direction?
As for structured logging, I stumble across key differences between how AppInsights is handled when using the dotnet-isolated worker as opposed to the in-process model. In the dotnet-isolated process, support for AppInsights is not on the same level as in the in-process model, nor does it follow the same documentation and naming conventions one might get used to when using regular aspnet console programs or in-process azure functions.
Reference:
- https://github.com/Azure/azure-functions-host/issues/7452
- https://github.com/Azure/azure-functions-dotnet-worker/issues/1182
I see a couple of ways out of this:
-
Pivot the lesson to use in-process azure functions instead
- pros: App Insights works outof the box with
ILogger - cons: this deviates from all other lessons
- pros: App Insights works outof the box with
-
Include custom code and preview NuGet packages to support structured logging in isolated mode
- pros: it will work !
- cons: this would probably be a bit too complex and would be obsolete when microsoft finally fixes those issues.
Can you please tell me what you think?
@springcomp The structure of the lesson looks good! Good addition of the decision chart for log levels.
I really prefer the content to be specific for dotnet isolated since that is the way forward in general. I know there are a lot of differences compared to in-process. I'm OK with using preview packages as long as this is clearly stated in the lesson. What if you move structured logging and distributed tracing to a separate (advanced logging) lesson?
Sure I can do that.
I was under the impression that without those two last chapters, I would not be adding much value. But if you think that is valuable in its own right, I will split and publish a simpler lesson.