Exemplo n.º 1
0
        private static Screenboard GetDashBoard(DataDogConfig datadogConfiguration, string dashboardId)
        {
            var dProcessor = new DataDogProcessor(datadogConfiguration);
            var dashboard  = dProcessor.GetDashboardById(dashboardId);

            return(dashboard);
        }
Exemplo n.º 2
0
        private static void ProcessSingleWidget(DataDogConfig datadogConfiguration, string dashboardId, string checkId, string checkName)
        {
            if (string.IsNullOrEmpty(dashboardId))
            {
                throw new ArgumentNullException("DashboardId is missing");
            }

            if (string.IsNullOrEmpty(checkId))
            {
                throw new ArgumentNullException("checkId is missing");
            }

            if (string.IsNullOrEmpty(checkName))
            {
                throw new ArgumentNullException("checkName is missing");
            }


            var dProcessor = new DataDogProcessor(datadogConfiguration);
            var dashboard  = dProcessor.GetDashboardById(dashboardId);
            var title      = checkName;

            var wigetsToAdd = new List <Widget> {
                Widget.CreatePingdomCheckWidget(title, checkName, checkId)
            };
            var updateddashboard = dProcessor.AddWidgetDashboard(dashboard, wigetsToAdd);
        }
Exemplo n.º 3
0
        private static void ProcessFileForWidgets(DataDogConfig datadogConfiguration, string path)
        {
            if (!File.Exists(path))
            {
                throw new FileNotFoundException($"File Not found {path}");
            }

            // Open the file to read from.
            var readText = File.ReadAllLines(path);

            foreach (var s in readText)
            {
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }

                Logger.Debug(s);
                var dashboardId = _clp.Options.DashboardId;
                var splitLine   = s.Split('|');

                var checkId   = splitLine[0]; //"";
                var checkName = splitLine[1]; // "";
                ProcessSingleWidget(datadogConfiguration, dashboardId, checkId, checkName);
            }
        }
Exemplo n.º 4
0
        private static void SubmitMetricToDd(DataDogConfig datadogConfiguration)
        {
            var dProcessor = new DataDogProcessor(datadogConfiguration);
            var ddms       = new DataDogMetricSeries
            {
                series = new List <Series>
                {
                    new Series {
                        metric = "TestApp.TestCounter", points = new List <List <long> > {
                            new List <long> {
                                DateTimeOffset.UtcNow.ToUnixTimeSeconds(), 5
                            }
                        }
                    }
                }
            };


            dProcessor.SubmitSingleMetric(ddms);
            Logger.Info("Metric Sent");
        }
 public DataDogProcessor(DataDogConfig datadogConfiguration)
 {
     _config = datadogConfiguration;
 }