Пример #1
0
        private void NotifyFailureResult(HealthCheckResult result)
        {
            var failingLayerName = (result.AllResults.FirstOrDefault(r => r.Level >= LogLevel.Error)?.CheckId?.Name ?? "UnknownLayer").Truncate(MaxOpsgenieTagLength);
            var message          = result.Reason.Truncate(MaxOpsgenieMessageLength);

            var request = new OpsGenieCreateAlertRequest(this._settings.ApiKey, message)
            {
                Alias       = "nimator-failure",
                Description = _formatter.Format(result),
                Teams       = new[] { this._settings.TeamName },
                Tags        = new[] { "Nimator", failingLayerName }
            };

            SimpleRestUtils.PostToRestApi(AlertUrl, request);
        }
Пример #2
0
        private void NotifyFailureResult(INimatorResult result)
        {
            var failingLayerName = (result.GetFirstFailedLayerName() ?? "UnknownLayer").Truncate(MaxOpsgenieTagLength);
            var message          = result.Message.Truncate(MaxOpsgenieMessageLength);

            var request = new OpsGenieCreateAlertRequest(this.settings.ApiKey, message)
            {
                Alias       = "nimator-failure",
                Description = result.RenderPlainText(settings.Threshold),
                Teams       = new[] { this.settings.TeamName },
                Tags        = new[] { "Nimator", failingLayerName }
            };

            SimpleRestUtils.PostToRestApi(AlertUrl, request);
        }