c# - 用于 c# 作业的弹性 apm
问题描述
我将 ElasticAPM 添加到我在 AspNetCore 3.1 上的启动中
app.UseAllElasticApm(Configuration);
在我的项目中,rest api services 记录为 kibana-apm 的事务选项卡。但是我的后台服务没有被 apm 代理记录,只有指标选项卡对我有用。
解决方案
目前后台服务不是开箱即用的。
您可以做的是使用公共代理 API,并使用一些额外的代码,您也可以将它们捕获为事务。
在后台服务中是这样的:
var transaction = Elastic.Apm.Agent
.Tracer.StartTransaction("MyTransaction", ApiConstants.TypeRequest);
try
{
//background service code that is captured as a transaction
}
catch (Exception e)
{
transaction?.CaptureException(e);
throw;
}
finally
{
transaction?.End();
}
推荐阅读
- javascript - 如果没有 tabindex,滚动子 div 不起作用?
- java - ambari + 无法通过端口 8088 访问资源管理器 WebUI
- python - jinja2 UndefinedError: 'individual_page' 未定义
- c# - 使用 automapper 的 xUnit 和 .Net 核心后测试用例问题(我猜)
- java - 如何将java对象列表转换为Map
> - git - 如何从 github 历史记录中删除敏感文件
- swift - 关于persistentStoreDescriptions的配置问题
- html - 带有 flexbox 和意外行为的 HTML 表格和 div
- rest - Boost Beast异步休息客户端:async_resolve - 解决:找不到主机(权威)
- c# - 根据我放置断点的位置在 API 集成测试中获取不同的 HTTP 响应