Monitoring .Net with OpenTelemetry Prometheus and Grafana

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

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

  • @Pierre.69
    @Pierre.69 5 месяцев назад

    Used prometheus and grafana for the first time today with your help, useful video, thanks!

    • @developingwoot
      @developingwoot  5 месяцев назад

      Awesome! I'm so glad to hear that. It's a super cool platform.

  • @oladejiakomolafe5591
    @oladejiakomolafe5591 2 месяца назад

    Good. Clear and succinct explanation. Thank you

  • @papciuszkin
    @papciuszkin 4 месяца назад

    Great video! Really clear and to the point

  • @rupenanjaria
    @rupenanjaria 5 дней назад

    Nice vide0, however, I am getting "System.NotSupportedException: 'Endpoint URI scheme (otel-collector) is not supported. Currently only "http" and "https" are supported.'" when trying to run. The error seems from program.cs builder configuration line. Any idea?

    • @developingwoot
      @developingwoot  4 дня назад

      I did get that error too at one point. It's been a minute and I can't remember what my solution was.. I think it had to do with something misconfigured in my appsettings but I'm not totally sure. If your code is in a public repo I'd be happy to dig through it and see if I can figure it out.

    • @rupenanjaria
      @rupenanjaria 2 дня назад +1

      @@developingwoot nm, I was able to run it. I was trying to run using visual studio command, instead I should use docker command, that was the issue. Thank you.

  • @nadimkhoury8010
    @nadimkhoury8010 2 месяца назад

    nice, is there a way to then store the data in a postgreSQL data base

    • @developingwoot
      @developingwoot  2 месяца назад

      Prometheus uses time series data and PostgreSQL isn't to my knowledge optimized for that type of data. There are other databases that are like influxdb and it supports remote read and write. I've never used it myself because we just haven't needed any additional storage solution up to this point

  • @catex5452
    @catex5452 6 месяцев назад

    I want to track a dateTime value with System.Diagnostics.Metrics, OpenTelemetry, Prometheus and Grafana. Is that possible? Right now I did it with a counter where I add unix seconds but that's probably not optimal... If I could display the unix seconds as a date in grafana that would technically be enough though. Can you help?

    • @developingwoot
      @developingwoot  6 месяцев назад

      What specifically are you trying to track? For example are you trying to track the length of time it takes a request to complete?

    • @catex5452
      @catex5452 6 месяцев назад

      @@developingwoot I want to track the date + time when something got imported and the date + time of the next import. I just changed my logic to using two ObervableGauge's for it (lastImportTime, nextImportTime). Each returns a list of measurments containing a long value(unix timestamp) + tag. I basically just want to show two dates in my grafana dashboard. Last Import and next import.

    • @catex5452
      @catex5452 6 месяцев назад

      The tags consist of a key "environment" and a string which represent the type of document that got imported. I'd like to create dashboards for the different tags. for example lastImportedXmlDate, lastImportedJsonDate etc. So I want more than just two dates, sorry for the wrong information. Two dates per environment.

    • @developingwoot
      @developingwoot  6 месяцев назад

      @@catex5452 are you just wanting logs or are you charting this?

    • @catex5452
      @catex5452 6 месяцев назад

      @@developingwoot I'm not sure if I know what you mean. I think I just want to display stats. (I never worked with Grafana before)
      Here you can see my code:
      using System;
      using System.Diagnostics.Metrics;
      namespace Import.FileListener
      {
      public class MetricsManager
      {
      private Meter meter;
      private Counter importedCounter;
      private ObservableGauge lastImportTimeGauge { get; set; }
      private ObservableGauge nextImportTimeGauge { get; set; }
      private List lastImportTimes = new List();
      private List nextImportTimes = new List();
      // Singleton instance of MetricsManager
      private static readonly MetricsManager _instance = new MetricsManager("MetricsManager", "1.0.0");
      public static MetricsManager Instance => _instance;
      private MetricsManager(string meterName, string meterVersion)
      {
      meter = new Meter(meterName, meterVersion);
      importedCounter = meter.CreateCounter("imported-files");
      lastImportTimeGauge = meter.CreateObservableGauge("last-import-time", () => { return lastImportTimes; });
      nextImportTimeGauge = meter.CreateObservableGauge("next-import-time", () => { return nextImportTimes; });
      }
      public void SetImportTimes(string fileName, DateTime lastImport, int intervalSeconds)
      {
      long lastTime = new DateTimeOffset(lastImport).ToUnixTimeSeconds();
      long nextTime = new DateTimeOffset(lastImport.AddSeconds(intervalSeconds)).ToUnixTimeSeconds();
      lastImportTimes.Add(new Measurement(lastTime, new KeyValuePair("environment", fileName)));
      nextImportTimes.Add(new Measurement(nextTime, new KeyValuePair("environment", fileName)));
      }
      public void Increment(string fileName)
      {
      importedCounter.Add(1, new KeyValuePair("environment", fileName));
      }
      }
      }

  • @rajeshk5211
    @rajeshk5211 6 месяцев назад

    Can you please extend the video including loki for logging

    • @developingwoot
      @developingwoot  6 месяцев назад

      Oh that's a good idea. I'll see what I can do. I hope you found what's there helpful.

    • @rajeshk5211
      @rajeshk5211 6 месяцев назад

      ​@developingwoot The video is simple and straightforward, and it is indeed very useful. Thanks for your effort.

  • @KnowledgePlayTV
    @KnowledgePlayTV 7 месяцев назад

    can you please make a video on opentelemetry + .net core without docker? btw nice lecture and useful content.

    • @developingwoot
      @developingwoot  7 месяцев назад +1

      Yeah I could probably do something like that are you still thinking Prometheus and Grafana? I used Docker because it is really nice in that it just starts those services for you. But I'll see what I can do.

    • @KnowledgePlayTV
      @KnowledgePlayTV 7 месяцев назад

      @@developingwoot thank you for your reply.

    • @developingwoot
      @developingwoot  6 месяцев назад +1

      I've posted that video for you 👍

    • @KnowledgePlayTV
      @KnowledgePlayTV 6 месяцев назад

      @@developingwoot thank you so much for your effort.