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); }
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); }
public void Notify(INimatorResult result) { if (settings.DebounceTimeInSecs > 0 && DateTime.Now < dontAlertBefore) { return; } if (result.Level >= settings.Threshold) { var message = new SlackMessage(result, settings.Threshold, settings.SourceEnvironment); if (settings.DebounceTimeInSecs > 0) { dontAlertBefore = DateTime.Now.AddSeconds(settings.DebounceTimeInSecs); message.AddAttachment("Debouncing messages until at least *" + dontAlertBefore.ToString("yyyy-MM-dd, HH:mm:ss") + "*, even if more problems arise."); } SimpleRestUtils.PostToRestApi(settings.Url, message); } }
public void Send([NotNull] HealthCheckResult result) { Guard.AgainstNull(nameof(result), result); if (_settings.DebounceTimeInSecs > 0 && DateTime.Now < _dontAlertBefore) { return; } result.Finalize(result.CheckId, r => r.Level >= _settings.Threshold); if (result.Level >= _settings.Threshold) { var message = new SlackMessage(result, _formatter); if (_settings.DebounceTimeInSecs > 0) { _dontAlertBefore = DateTime.Now.AddSeconds(_settings.DebounceTimeInSecs); message.AddAttachment("Debouncing messages until at least *" + _dontAlertBefore.ToString("yyyy-MM-dd, HH:mm:ss") + "*, even if more problems arise."); } SimpleRestUtils.PostToRestApi(_settings.Url, message); } }
private void SendHeartbeat() { var request = new OpsGenieHeartbeatRequest(this._settings.ApiKey, this._settings.HeartbeatName); SimpleRestUtils.PostToRestApi(HeartbeatUrl, request); }