当前位置: 首页 > news >正文

虹口免费网站制作天津快速关键词排名

虹口免费网站制作,天津快速关键词排名,网站架设流程,莒县网页设计Jaeger使用 注: Jaeger服务端版本为:jaegertracing/all-in-one-1.6.0 OpenTracing版本为:0.33.0,最后一个版本,停留在May 06, 2019。最好升级到OpenTelemetry。 Jaeger客户端版本为:jaeger-client-1.3.2。…

Jaeger使用

注:
Jaeger服务端版本为:jaegertracing/all-in-one-1.6.0
OpenTracing版本为:0.33.0,最后一个版本,停留在May 06, 2019。最好升级到OpenTelemetry。
Jaeger客户端版本为:jaeger-client-1.3.2

Tags

Tag是一个非常常见的概念,时序数据库如InfluxDB,Prometheus里的基础概念。Jaeger也有这个概念,如下Jaeger UI里有一个Tags,主要用于筛选过滤部分可能会造成干扰的数据。
在这里插入图片描述
点击某个Trace进去,会发现如下信息:
在这里插入图片描述
因此,可输入如下内容实现过滤搜索:

  • 精确匹配:hostname=DESKTOP-L20EH42
  • 排除匹配:hostname=~DESKTOP-L20EH42

其他可用的Tag(常用的在前面):

  • hostname
  • ip
  • http.status_code
  • http.method
  • http.url
  • jaeger.version
  • component
  • span.kind
  • sampler.type
  • sampler.param

排除特定路径

在这里插入图片描述
如上图,Operation里列出该应用下的所有接口。

在k8s集群里,pod健康检查需要应用暴露一个/health接口。这个/health接口是写在框架Jar里的,而不是每个应用都写一个HealthController(虽然可以这样做,我在上家公司也这样干过)。

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.http.MediaType;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.reflect.Method;@Slf4j
@Component
@RequiredArgsConstructor
public class HealthyConfiguration implements ApplicationRunner {private final RequestMappingHandlerMapping requestMappingHandlerMapping;@Overridepublic void run(ApplicationArguments args) {RequestMappingInfo healthRequestMappingInfo = RequestMappingInfo.paths("/health").methods(RequestMethod.GET).produces(MediaType.APPLICATION_JSON_VALUE).options(requestMappingHandlerMapping.getBuilderConfiguration()).build();Method healthMethod = ReflectionUtils.findMethod(getClass(), "health", HttpServletRequest.class, HttpServletResponse.class);requestMappingHandlerMapping.registerMapping(healthRequestMappingInfo, this, healthMethod);}@ResponseBodypublic R<String> health(HttpServletRequest request, HttpServletResponse response) {return R.success("ok", "ok");}
}

需求:类似于这个GitHub Issue,Jaeger能不能不收集应用下的特定接口,即,排除特定路径。

方案

经过各种尝试,以及Google,DeepSeek,ChatGPT,最后还是GitHub Copilot给出的答复能解决问题。

新增一个Filter类,当然这个Filter类也是需要放在框架Jar里,然后所有应用都需要去引用它:

import com.johnny.security.util.CommonUtil;
import io.opentracing.Tracer;
import io.opentracing.util.GlobalTracer;
import org.springframework.context.annotation.Configuration;import javax.servlet.*;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;/*** @author johnny*/
@Configuration
public class TracingInterceptor implements Filter {private final Tracer tracer;public TracingInterceptor() {this.tracer = GlobalTracer.get();}@Overridepublic void doFilter(ServletRequest servletRequest, ServletResponse response, FilterChain chain) throws IOException, ServletException {HttpServletRequest request = (HttpServletRequest) servletRequest;String path = CommonUtil.getRequestPath(request);// 排除/health路径if ("/health".equals(path)) {// 停止当前请求的Tracingtracer.activeSpan().finish();chain.doFilter(servletRequest, response);return;}chain.doFilter(servletRequest, response);}
}

CommonUtil工具类如下:

public class CommonUtil {/*** 获取请求路径*/public static @NotNull String getRequestPath(HttpServletRequest request) {String path = "";String servletPath = request.getServletPath();if (StrUtil.isNotBlank(servletPath)) {path += servletPath;}String contextPath = request.getContextPath();if (StrUtil.isNotBlank(contextPath)) {path += contextPath;}String pathInfo = request.getPathInfo();if (StrUtil.isNotBlank(pathInfo)) {path += pathInfo;}return path;}
}

参考

  • GitHub Copilot
http://www.15wanjia.com/news/26678.html

相关文章:

  • 传奇手游网页版南昌seo推广
  • 新闻发稿计划排名优化系统
  • 网页设计实验报告重庆交通大学凯里seo排名优化
  • 深圳国税局深圳做网站公司顶尖文案
  • java编程软件网站优化价格
  • 杭州高瑞网站建设百度竞价开户哪家好
  • 南宁手机做网站公司app拉新推广平台代理
  • 网站集约化建设必要性热搜榜排名前十
  • wordpress 党建模板关键词优化难度分析
  • 平阳住房和城乡规划建设局网站常见的网络营销工具
  • 法院网站建设爱站网关键词搜索
  • wordpress能用的插件合肥优化
  • 建一个网站大约需要花费多少钱宝塔建站系统
  • 上海门户网保定seo推广公司
  • html5做简单网站舆情报告
  • 免费网站可以做淘宝客吗宁国网络推广
  • 建设一个视频网站需要什么条件正规的计算机培训机构
  • 做外卖网站网站推广优化外包便宜
  • 精美网站欣赏爱站网seo
  • 河南省建设注册执业中心网站广告宣传网站
  • 道教佛像网站怎么做seo标题生成器
  • 网页和网站区别seo交互论坛
  • 网页游戏4399在线游戏安徽seo报价
  • 福田建网站公司南宁seo外包要求
  • 微网罗湖区seo排名
  • 如何取一个大气的名字的做网站网页设计与制作模板
  • 怎么做电脑端网站设计稿优化设计电子版在哪找
  • 山东淄博微信网站制作建站系统有哪些
  • 专注于上海seo做网站建设搜索引擎排名优化程序
  • 网站转换模块怎么做排名软件