- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我创建了扩展警报管理器:界面
public interface AlertManagerExt extends AlertManager {
void successCode(String messageCode, Object... args);
void infoCode(String messageCode, Object... args);
void warnCode(String messageCode, Object... args);
void errorCode(String messageCode, Object... args);
}
和实现
public class AlertManagerExtImpl extends AlertManagerImpl implements AlertManagerExt {
private final Messages messages;
public AlertManagerExtImpl(ApplicationStateManager asm, Request request, AjaxResponseRenderer ajaxResponseRenderer,
PerthreadManager perThreadManager, Messages messages) {
super(asm, request, ajaxResponseRenderer, perThreadManager);
this.messages = messages;
}
@Override
public void successCode(String messageCode, Object... args) {
success(getMessage(messageCode, args));
}
@Override
public void infoCode(String messageCode, Object... args) {
info(getMessage(messageCode, args));
}
@Override
public void warnCode(String messageCode, Object... args) {
warn(getMessage(messageCode, args));
}
@Override
public void errorCode(String messageCode, Object... args) {
error(getMessage(messageCode, args));
}
protected String getMessage(String code, Object... args) {
if (args.length > 0) {
return messages.format(code, args);
}
return messages.get(code);
}
}
当我尝试通过 Binder 绑定(bind)它时:
binder.bind(AlertManagerExt.class, AlertManagerExtImpl.class);
我遇到异常:
java.lang.RuntimeException: Service interface org.apache.tapestry5.alerts.AlertManager is matched by 2 services: AlertManager, AlertManagerExtImpl. Automatic dependency resolution requires that exactly one service implement the interface.
at org.apache.tapestry5.ioc.internal.RegistryImpl.getServiceByTypeAlone(RegistryImpl.java:789)
at org.apache.tapestry5.ioc.internal.RegistryImpl.getServiceByTypeAndMarkers(RegistryImpl.java:797)
at org.apache.tapestry5.ioc.internal.RegistryImpl.getService(RegistryImpl.java:755)
我知道我可以复制并粘贴 AlertManager 中的所有方法并且不扩展它。但可能有更好的方法吗?
最佳答案
这是因为当您尝试仅按接口(interface)类型@Inject
时,Tapestry IoC 会尝试查找实现接口(interface)的所有服务。您的新 AlertManagerExt
也实现了 AlertManager
因此存在歧义。
这通常可以通过显式指定服务 ID 或标记注释来解决,但这不适用于您的情况,因为 Tapestry 的核心代码已经通过接口(interface) @Inject
ing AlertManager
仅。
关于java - 如何覆盖 Tapestry AlertManager,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42642853/
我正在开发一个仪表板,它接收所有 Alertmanager 读数并处理它们。我在请求负载中寻找一个唯一的字段来在我的数据库中创建一个唯一的外部警报 ID。请求有效负载如下所示: { "status
我正在使用警报管理器来获取普罗米修斯指标的警报,我对不同的指标有不同的警报规则,是否可以为每个警报规则设置不同的间隔,例如对于 metric1,我有规则 1,我需要每天检查此规则间隔,对于 metri
我目前正在尝试设置 Prometheus 和 Alertmanager,我遇到但尚未找到解决方案的问题是我希望通过 oauth2 授权将警报发送到我们的自定义应用程序。 有什么方法可以构建/配置自己的
我面临一个问题,我在alert_rules.yml中使用以下规则 当我收到警报时,它不会返回容器正在运行的主机名。如何实现返回主机名而不是节点ID? 我尝试使用container_label_com_
我是 Loki 的新手,在 Loki 中发出了警报,但我在 Alertmanager 中没有看到任何通知。 Loki 工作正常(收集日志),Alertmanager 也正常(从其他来源获取警报),但来
我在这里看过这个问题/答案:Prometheus AlertManager - Send Alerts to different clients based on routes 这对我来说是一个很好的
我有 2 个服务 A 和 B 我想监视它们。此外,我有 2 个不同的通知 channel X 和 Y 在 AlertManager 配置文件中以 receivers 的形式。 如果服务 A 宕机,我想
虽然 Prometheus 说警报已被触发,但我的警报管理器没有收到任何警报。它说“没有警报”。 这只是为了在我的本地机器上进行测试。这是我的 prometheus.yml --- rule_file
我正在尝试通过 Prometheus 设置 Alertmanager。我已经编写了警报规则和 alertmanager.yaml 文件。我可以通过 alertmanager 向 slack 发送警报。
我创建了扩展警报管理器:界面 public interface AlertManagerExt extends AlertManager { void successCode(String m
我目前正在重新设计警报管理器的现有警报配置。只有一个小问题,我不完全了解警报管理器。 假设我有以下配置; routes: match: severity:"warning" receiver: "
我们使用 PrometheusOperator 在 kubernetes 集群中设置了 Prometheus。我们正在尝试使用 AlertManagerConfig 自定义资源配置 AlertMana
我的警报配置如下。 ALERT PoDHighCPUUsage IF sum(rate(container_cpu_usage_seconds_total{container_label_io_k
我有 Prometheus 运算符,它按预期工作 https://github.com/coreos/prometheus-operator 现在我想申请 alert manager从零开始 阅读文档
我用的是官方stable/prometheus-operator chart 确实使用 helm 部署 Prometheus。 到目前为止,它运行良好,除了烦人的 CPUThrottlingHigh为
情况:我设置了 Prometheus 和 Alertmanager,用于监控各种设备的 CPU 温度等。 Alertmanager 将警报从生产设备发送到 PagerDuty。 我正在监控的设备有不同
我们 Android 应用程序的一个主要组件是在特定时间使用 AlarmManager 向用户发送通知。 . 当用户创建新的“记录”时,我们会在现场排队发出警报。因此,如果下载应用程序、打开它并创建一
我想用 tls 和身份验证来保护我的 Alertmanager,这样在我的网络中,并不是每个人都能访问面向公众的端点。我不想使用 nginx 服务器作为代理。这将是我的普罗米修斯配置: global:
我试图在一个简单的设置中设置警报管理器,它会为收到的每个通知发送一个 Slack 通知。 我希望通过删除 group_by 配置来禁用分组。 问题是,当我一个接一个地发送 2 个警报时,即使警报管理器
我正在使用 Promtail + Loki 来收集我的日志,但我不知道如何提醒 每我的日志文件中的错误。我也在使用 Prometheus、Alertmanager 和 Grafana。我看到有些人已经
我是一名优秀的程序员,十分优秀!