Intro to Health Checks in .NET Core

Поделиться
HTML-код
  • Опубликовано: 5 янв 2025

Комментарии • 118

  • @xiaoyu88
    @xiaoyu88 2 года назад +3

    Tim, whenever I tell people to look you up they are going like "WHAT? AN HOUR LONG?" and I tell them "just try and see for yourself". There was not even one who did not come back to me to thank me (and you, of course). You are just great. Thank you for all the hard work you put in those tutorials.
    Even this not-needed-lambda-expression-breakdown part was explained well in other tutorials, but you seem to take care of everyone, even new comers.

    • @IAmTimCorey
      @IAmTimCorey  2 года назад

      Awesome! Thanks for sharing.

  • @RalfsBalodis
    @RalfsBalodis 4 года назад +17

    0:00 - Intro
    1:46 - Creating a demo Blazor Server App
    3:27 - About Application Health
    5:35 - Adding Health Check NuGet packages
    6:53 - Configure Health Checks : Health states
    15:03 - Configure Health Checks: Advanced info
    18:41 - Configure Health Checks: Overall application check
    21:27 - Side note: Lamda expression break down
    23:37 - Configure Health Checks: Tags
    28:21 - Better Health Checks data view: app setup (quick NuGet references)
    32:47 - Better Health Checks data view: configuration
    34:02 - Better Health Checks data view: appsettings.json;
    38:21 - Better Health Checks data view: running the app
    40:58 - Implementing Health Checks in application: MVC app setup
    46:04 - Custom App Health Check: Practical Health Checks
    55:07 - Implementing Custom App Health Checks
    1:02:29 - Health Checks: Recap
    1:03:50 - What are health checks for and what should you check?
    1:10:44 - Security concerns
    1:12:35 - Concluding remarks
    43:25 *one does not simply remember about the clipboard ring at 1am *

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +2

      Thank you kind sir. Added!

  • @shahzshafie
    @shahzshafie 4 года назад +1

    Tim, you made learning .net core really easy! Health Check in .NET Core is something i've been waiting for! great stuff! Thanks buddy!

  • @ignask2216
    @ignask2216 4 года назад +3

    Was waiting for this video for a long time! Thanks Tim!

  • @chiidtech
    @chiidtech 3 года назад

    Thank you Tim, you are a blessing to us...

  • @AK-wo7jz
    @AK-wo7jz 4 года назад

    Excellent explanation Tim....one of the Very helpful video....Thanks for educating us/community...

  • @refactorear
    @refactorear 4 года назад

    We haven't thought about this, we were just using a status page returning OK. Maybe we can implement it in the future, thanks!
    43:30 Tip, just copy the json, paste it, then select the copied port and press ctrl+shift+v to show the clipboard history and choose the port number you previously copied to overwrite the other value.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +3

      Yeah, the problem is that I can't use that on camera unless I've ensured that all of my copied text is fine to view. If I copied a password, a client's IP address, or another sensitive bit of information, I don't want that recorded on video (and I don't want to have to blur it later on).

  • @НереальнаяАвстралия

    Thank you for that! I think the bit where we actually call the services is missing. We are using the random generator which is ok only for demonstration purposes. I would really like to find out what are the best practices for the health check implementation. Say we have a SQL Server Db which stores some data. How do we implement the actual check for it? Or if we have a Web API, what are the best practices to check its health?

    • @IAmTimCorey
      @IAmTimCorey  2 года назад +1

      Check to be sure you can connect to each. Maybe check a simple query timing. Same for the API. Check response time for a call to the API.

    • @НереальнаяАвстралия
      @НереальнаяАвстралия Год назад

      @@IAmTimCorey thank you Tim!

  • @majidakbari3289
    @majidakbari3289 3 года назад

    Perfect, thank you for your time and all your tutorials. I've got a suggestion for you; You've named the playlist `Advanced Topics`, but during the video you explain how IDE import works or what is arrow function and similar topics that are really primitive. I guess if you omitted this kind of information during the videos, you'd have shorter and more advanced output.

    • @tomthelestaff-iamtimcorey7597
      @tomthelestaff-iamtimcorey7597 3 года назад +1

      You hit on the topic that is a constant struggle for every teacher. What do my students already know? Every advanced video gets blasted with comments about what you failed to teach so we can understand this material. Its a balance and Tim tends to error on giving too much rather to strict assumptions on levels of experience. Thanks for watching and trusting Tim.

  • @aminjafer4535
    @aminjafer4535 Год назад

    Thank you for this!

  • @erikthysell
    @erikthysell 4 года назад

    Tim, you're the man! This is great. Would it be possible for you to give a show on thread-safe collections (i.e. concurrentqueue), lock {}, how/when to use and so forth?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      Noted on my list. Thanks for the idea.

  • @skarabei2303
    @skarabei2303 Год назад

    Ok but how to add for every action in the controllers. If I need to make this manually... ???

  • @masoodmunshie203
    @masoodmunshie203 3 года назад

    Thanks, Great Explanation .

  • @davidmorello9229
    @davidmorello9229 3 года назад

    Great video!! Thanks.

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      You are welcome.

    • @davidmorello9229
      @davidmorello9229 3 года назад

      @@IAmTimCorey do you have a video that calls another endpoint and sets the status based on the response time?

  • @wright.nguyen
    @wright.nguyen 3 года назад

    How to monitor this healthcheck on azure app service?

  • @29misho
    @29misho Год назад

    Thanks for the tutorial. I think it would be good if you show us how this stuff works on load balancer side

    • @IAmTimCorey
      @IAmTimCorey  Год назад

      Thanks for the suggestion. Please add it to the list on the suggestion site so others can vote on it as well: suggestions.iamtimcorey.com/

  • @duanernivlys
    @duanernivlys 4 года назад +5

    Hi Tim, for me this is the best off all. I've been looking for such a system quite a long. This is my question. How to add healthcheck to Service worker project implemented with .NET Core? I have many ones doing logging and I want to monitor them in a single place like this. Thanks!

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +6

      I can add that to the suggestion list to cover in a future video.

  • @soucianceeqdamrashti8175
    @soucianceeqdamrashti8175 3 года назад

    Excellent video! Maybe for a follow you could present how to expose the health endpoints and the UI using authentication. But yeah great content!

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      I will add it to the list. Thanks for the suggestion.

  • @TeofilYankulov0
    @TeofilYankulov0 3 года назад

    Hello Tim and thank you for your video. My question is: SetEvaluationTimeInSeconds is responsible for the UI poll, but wat if I want to set the UI poll to be every 5 seconds, so SetEvaluationTimeInSeconds(5) but one of the checks to be checked on every 5 minutes? Do I need to use the TimeSpan and if yes, could you show how? Highly appriciate your videos, keep going!!

  • @girornsveinsson7970
    @girornsveinsson7970 3 года назад

    Very interesting video. I am running into a tons of problems though when I want to add a healthcheck to a Blazor Server App with Windows authentication. The endpoint works fine and the chek results are visible there but the HealthChecker client always shows an error: Unexpected character encountered while parsing value:

  • @victormcezar
    @victormcezar 4 года назад +3

    Hi Tim, thanks for this tutorial. It was very enlightening!
    I would like to use that to monitor multiple micro services and I was wondering if It is possible to group or tag applications the same way we can tag HealthChecks?

  • @dasfahrer8187
    @dasfahrer8187 Год назад

    Got a follow-up on this for customizing the UI (colors, logo, etc)?

    • @IAmTimCorey
      @IAmTimCorey  Год назад +1

      Not yet, but you can add that as a suggestion: suggestions.iamtimcorey.com

    • @dasfahrer8187
      @dasfahrer8187 Год назад

      @@IAmTimCorey Done, thanks.

  • @BermeoMiguel
    @BermeoMiguel 3 года назад

    Hi Tim, thanks in advance for the video. Is possible to implement that logic of HealthChecksUI to an Azure functions project? I asked because in a project that I want to implement it I realize that the Startup class implements the interface FunctionsStartup and this interface doesn't have an IApplicationBuilder app param to be able to perform the respective settings. Thank you!

  • @williambonneau2614
    @williambonneau2614 Год назад

    I got this error at 38 min '

    • @IAmTimCorey
      @IAmTimCorey  Год назад

      Look for that symbol in your code.

    • @williambonneau2614
      @williambonneau2614 Год назад

      @@IAmTimCorey The problem is that I don't have this symbol in my code, but I took another part of the code I made earlier and now it works, so I can continue the video ;)

    • @williambonneau2614
      @williambonneau2614 Год назад

      @@IAmTimCorey all works fine :) now I try to save in database results ;)

  • @shawnsmith8975
    @shawnsmith8975 2 года назад

    I have my app hosted in Azure app services which has App Insights, logging and Health Checks, do I need this if I am using those services?

    • @IAmTimCorey
      @IAmTimCorey  2 года назад

      This is how you tell Health Checks if your app is healthy, so yes, that is necessary. If you don't tell it, all Health Checks can do is say that your web server is running. It cannot tell if your app is running correctly, if your database is responding, etc.

    • @shawnsmith8975
      @shawnsmith8975 2 года назад

      @@IAmTimCorey Ok Thanks

  • @zulhishamtan4308
    @zulhishamtan4308 4 года назад +1

    Hi Tim,
    This is really awesome.
    But I do have a question.....Instead of using in-memory storage, how can we wire it up with SQL or ElasticSearch?
    I love .Net !

    • @MikevanKuik
      @MikevanKuik 4 года назад

      Tim actually has made a video about that.
      ruclips.net/video/Et2khGnrIqc/видео.html How to connect C# to SQL (the easy way)
      It's also quite easy to change out MSSQL with MYSQL if you choose to do so.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      Here you go: github.com/Xabaril/AspNetCore.Diagnostics.HealthChecks/issues/455#issuecomment-613093369

    • @zulhishamtan4308
      @zulhishamtan4308 4 года назад

      @@IAmTimCorey Thank you very much. Really appreciate it.

  • @laptoprecaia.k.aagentsmith3328
    @laptoprecaia.k.aagentsmith3328 2 года назад

    wow, thanks a lot.

  • @mp3311
    @mp3311 4 года назад

    I am using AspNetCore.HealthChecks.UI version 2.2.35, so I am not able to install the client and the memory storage, as they have newer versions. Is there any solution so that I can use the better interface for health checks?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      Can you check for previous versions? NuGet packages allow you to install older versions, not just the latest. Maybe you can roll back to a previous version where those were supported.

  • @webdeveloperninja9220
    @webdeveloperninja9220 4 года назад +1

    Thank you

  • @happysoul1156
    @happysoul1156 2 года назад

    How to trigger a mail when health checks returns degraded ??

    • @IAmTimCorey
      @IAmTimCorey  2 года назад +1

      You are the one that is writing the code to determine that the health of the site is degraded. In that spot, also trigger an email. Or you can use a monitoring application on the other end to watch for the degraded value.

    • @happysoul1156
      @happysoul1156 2 года назад

      @@IAmTimCorey thanks for your valuable time

  • @Baby4Ghost
    @Baby4Ghost 4 года назад

    Hi Tim, great job on the video!
    The way im planning to implement an Monitoring App is to ping-check every minute and full-check every 5min with alerts going out if something is degraded, and prio-alert if something is unhealthy.
    This will be implemented for a Blazor Webshop, Web Api's / IdentityServer4 and an MSSQL database.
    Another feature I want is to check the logs for each application (every hour) for exceptions, errors and warnings like you mention.
    What Im wondering is, what would be an safe and practical way to provide the logs to the Monitoring App? Im using MS Logging icw Log4net.config. I am going to put the HealthChecks into its own NuGet package, so I could add the logs logic in that package (based on the log4net.config path) so it pushes the logs to the Monitoring App instead the Monitoring App retrieving it (retrieval = creating security issues as logs are sensitive data). What would you recommend?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      I like using Serilog with Seq for logging. That has a nice UI, it can be sent to any number of locations, and provides a way to really use even large amounts of log entries effectively.

    • @Baby4Ghost
      @Baby4Ghost 4 года назад

      @@IAmTimCorey Thank you, Im going to give it a read. I also see you have vids on it. Defintely going to check that out next!

  • @bilalmalik9551
    @bilalmalik9551 4 года назад

    Can i send health status to elasticsearch and checked status via kibana? Is it possible?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      Not sure. You would need to do some investigation.

  • @randysvids4774
    @randysvids4774 3 года назад

    Hi Tim, We have several health checks in our API application. Our Health checks run automatically every 5 seconds. Is there a way after all the health checks get run initially, certain health checks don't get run until you stop and start the APP and run the health checks the first time again? We have a configuration health check to ensure that all the app settings properties exist, and it runs pretty fast, but still prefer to only have it run once just the first time since our configs don't change too often.

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      Health checks get fired when you want them to so yes, you could fire them off just when the app starts.

    • @randysvids4774
      @randysvids4774 3 года назад

      @@IAmTimCorey do i have to do anything special for them to fire only once when the app starts?

  • @danail_iliev
    @danail_iliev 4 года назад +1

    Hi Tim, congratulations for bringing such a great tutorial to light! One thing is bugging me for the last days, tho. I am trying to write a health check for my SignalR hub. I am trying to use the AspNetCore.HealthChecks.SignalR package to do this, but the endpoint for my hub requires to also pass access token (hub has authorization) so I am getting the 401 error in my health checks page (no documentation on it at all). I wondered if you could include more advanced topics like this in a future tutorial? Or maybe I am entirely on the wrong path and that's not the right way to do it but I should go for a custom health check instead and its all my bad.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I will add it to the list. Thanks for the suggestion. I think you are on the right path.

  • @yanaraldaghestani6305
    @yanaraldaghestani6305 4 года назад

    Amazing

  • @wassimlaribi8597
    @wassimlaribi8597 4 года назад

    Hi Team, thanks for this awesome,simple and useful video.
    After implementing such monitoring too, usually we will need a tool to start/stop/restart services.
    do you have an advise about the best way to do this ?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      That would be a custom solution, but it would also depend on what you mean by "service". If it is a "service" on Azure (web app or web service), you can have Azure detect the degraded state and have it restart the service automatically.

    • @wassimlaribi8597
      @wassimlaribi8597 4 года назад

      @@IAmTimCorey thanks for your reply, make sense

  • @goldengriffin9096
    @goldengriffin9096 4 года назад

    Can someone help me by suggesting to me what to do next I've learned the basics of classes and objects, I understand classes and objects pretty well, I have then practiced some of my c# skills and I learned about LINQ (Language Integrated Queries) I'm now learning what delegates are afterward I will move onto lambda expressions then LINQ. Can anyone recommend other things to learn during my journey?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I touch on this in my Podcasts (#9 and others) iamtimcorey.com/p/podcast. Also on my Blog (How to Be a Great C# Developer). Its a very personal question and I am glad you are carefully exploring it. This video also may help - ruclips.net/video/LUv20QxXjfw/видео.html

  • @juanavelinosanlucas6129
    @juanavelinosanlucas6129 3 года назад

    Nice video!
    can i use this package in a .net core worker service project? what would be the best strategy?

  • @manishpatil8284
    @manishpatil8284 4 года назад

    Sir Aap.net Core MVC have scope in 2021..? Can tell full road map for web development from scratch to deployment

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      I am not sure what you mean by "scope". ASP.NET Core is the most modern web development platform from Microsoft. In November, Microsoft will release .NET 5 and update ASP.NET Core, but that should be somewhat minor. Going forward, I would definitely recommend using it. As for a path, I would recommend starting here: ruclips.net/video/LUv20QxXjfw/видео.html

    • @manishpatil8284
      @manishpatil8284 4 года назад

      @@IAmTimCorey Sir make video on Asp.net MVC Core full projects for beginners which cover all Concept of Web site development...real world project

  • @thequietone2868
    @thequietone2868 4 года назад

    What do you guys think about programming in linux? Should i develop on linux or windows machine, which is more suitable for programming?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      That is a broad question. It really depends on your specifics. Since you are on a channel dedicated to C#, I am going to assume you are referring to programming in C#. If that is the case, stick with Windows. You can develop C# on Linux using VSCode, as long as you work with .NET Core projects (not WInforms, WPF, or UWP though), but it is much easier to do so on Windows with Visual Studio.

  • @EliTheSoftwareDeveloper
    @EliTheSoftwareDeveloper 2 года назад

    Thank you for your wonderful contents. The source code not emailed to me :(

    • @IAmTimCorey
      @IAmTimCorey  2 года назад

      Check your spam folder. If it isn’t there, email help@iamtimcorey.com.

  • @romeozor
    @romeozor 4 года назад

    can this be used easily with docker container health reporting and orchestration?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      It depends on what you mean. You can use these inside of Docker containers (that's an ideal use-case), but Docker also has its own reporting on health, especially when you put it into a system like Kubernetes.

    • @romeozor
      @romeozor 4 года назад

      @@IAmTimCorey yes that’s what i mean, can (or should) Docker/k8s use this health report to determine the health of a container?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      Yes, the can be used that way (and it is usually the right call).

  • @willerpentonposada4284
    @willerpentonposada4284 4 года назад

    Hi TIm, I have requested the source code and I'm not receiving at all thank you

    • @IAmTimCorey
      @IAmTimCorey  3 года назад

      Sorry to hear that. Please drop a note to Help@IAmTimCorey.com and we will get the file to you. Specify the video so we know the right file to send. We got you covered!

  • @donovanm
    @donovanm 4 года назад

    Hello Tim, do you know how can I get the vscode javascript theme into vs2019 ?

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I think you would have to create it yourself.

  • @kevincordell9539
    @kevincordell9539 4 года назад

    Tim, thanks for your presentation. You always have awesome stuff to share with us here on RUclips and yes I have enrolled in a few of your courses to learn more and support you in providing us great content. I have one question here about HealthChecks. I found how to add the healthcheck for SQL Server and ping the server with a query. What I cannot find are any examples on how to return the results of the query. Let's say I have a web application and I am getting data from 3 or 4 databases (one being the logon database and 3 databases containing data) and I want to return the DB Name to the health check. I was able to add this to the Configuration section of the startup.cs: .AddSqlServer(connectionString: Configuration.GetConnectionString("Default"),
    healthQuery: "SELECT DB_NAME();",
    name: "Sql Server",
    failureStatus: HealthStatus.Degraded,
    tags: new[] { "db", "sql", "sqlserver" })
    How would I return the DB_Name() property?
    or would I have to write a separate class (like the ResponseTimeHealthCheck) to fetch and return the data?
    thanks

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      It is just like any other C# code, so you can query the database and read the data returned, then pass that on to the health check results in the description. However, if you are querying the database, you already know the name (it is in the connection string under "initial catalog" or "default database") so just parse that piece out.

  • @geovannycardozocedeno6041
    @geovannycardozocedeno6041 Год назад

    Genial

  • @Planet-C53
    @Planet-C53 4 года назад

    👍👍👍

  • @arefkr
    @arefkr 4 года назад

    75 minute video that had 20 seconds of valuable information

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +1

      Sounds like you weren’t looking to be introduced to health checks.

  • @farsidesc4044
    @farsidesc4044 4 года назад +1

    Hi Tim! Thanks for the video. Since I started doing web apps, I’ve had this question. Thank you for providing the answer I didn’t know I was looking for!
    I’m wondering if you wouldn’t mind adding a video on Kubernetes and C# apps. DevOps is basically ran on Kubernetes now. Even VMWare is shifting their concentration to managing and deploying K8 containers.

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +2

      Glad it was helpful! I have touched on some of these items in other videos, but I will put it on the list.

    • @farsidesc4044
      @farsidesc4044 4 года назад

      IAmTimCorey Thanks! I know that Docker has a bit of overlap and there are tools in VS that allow you to export to containers... but I think touching on the topic as a whole would be really helpful to a lot of people. Thanks for everything!

  • @VladislavSorokin
    @VladislavSorokin 4 года назад

    oh man, please install any JSON viewer to chrome, save our eyes and time looking over plain single line json text

    • @IAmTimCorey
      @IAmTimCorey  4 года назад +2

      I typically don't do things like that because it isn't standard. I try to limit how much I tell you to install just to follow along with the demo.

    • @VladislavSorokin
      @VladislavSorokin 4 года назад

      @@IAmTimCorey i ser. The reason is that json has hierarchy which is really hard to spot. Anyway, thank you for great videos.

  • @FirstLast-gc6ss
    @FirstLast-gc6ss 4 года назад

    first comment

  • @AliKhan-jz3zs
    @AliKhan-jz3zs 4 года назад

    you haven't answered my previous question. I'm sad

    • @IAmTimCorey
      @IAmTimCorey  4 года назад

      I looked and can't find it, please resend it.

    • @AliKhan-jz3zs
      @AliKhan-jz3zs 4 года назад

      @@IAmTimCorey this comment is from your previous video. I'm in interested in web with c#.and I'm confused what should I learn .net with Asp.net or .net core with asp.net core. Once I told you here in Nepal,are more opportunities in .net platform. Currently I'm doing front-end with react/js