@Test public void testProviderPressure() { Metadata metadata = new Metadata(); metadata.put(HEAD_KEY_TRAFFIC_TYPE, "pressure"); Context context = Context.current().withValue(TracingContextKey.getKeyMetadata(), metadata); context.attach(); PressureMarkTransformFilter filter = new PressureMarkTransformFilter(); filter.invoke(invoker, request); SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); Assert.assertTrue(TracerUtils.isLoadTest(currentSpan)); }
@Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); boolean loadTest = TracerUtils.isLoadTest(currentSpan); if (loadTest) { Map<String, String> metaHolder = MetadataHolder.getMetaHolder(); metaHolder.put(HEAD_KEY_TRAFFIC_TYPE.name(), PRESSURE); } Metadata metadata = TracingContextKey.getKeyMetadata().get(); if (metadata != null) { String s = metadata.get(HEAD_KEY_TRAFFIC_TYPE); if (PRESSURE.equals(s)) { currentSpan.getSofaTracerSpanContext().setBizBaggageItem(MARK, T); } } try { return invoker.invoke(request); } finally { MetadataHolder.clear(); } }
PressureMarkTransformFilter extends Filter { @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); boolean loadTest = TracerUtils.isLoadTest(currentSpan); if (loadTest) { Map<String, String> metaHolder = MetadataHolder.getMetaHolder(); metaHolder.put(HEAD_KEY_TRAFFIC_TYPE.name(), PRESSURE); } Metadata metadata = TracingContextKey.getKeyMetadata().get(); if (metadata != null) { String s = metadata.get(HEAD_KEY_TRAFFIC_TYPE); if (PRESSURE.equals(s)) { currentSpan.getSofaTracerSpanContext().setBizBaggageItem(MARK, T); } } try { return invoker.invoke(request); } finally { MetadataHolder.clear(); } } }
PressureMarkTransformFilter extends Filter { @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); boolean loadTest = TracerUtils.isLoadTest(currentSpan); if (loadTest) { Map<String, String> metaHolder = MetadataHolder.getMetaHolder(); metaHolder.put(HEAD_KEY_TRAFFIC_TYPE.name(), PRESSURE); } Metadata metadata = TracingContextKey.getKeyMetadata().get(); if (metadata != null) { String s = metadata.get(HEAD_KEY_TRAFFIC_TYPE); if (PRESSURE.equals(s)) { currentSpan.getSofaTracerSpanContext().setBizBaggageItem(MARK, T); } } try { return invoker.invoke(request); } finally { MetadataHolder.clear(); } }  }
PressureMarkTransformFilter extends Filter { @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); boolean loadTest = TracerUtils.isLoadTest(currentSpan); if (loadTest) { Map<String, String> metaHolder = MetadataHolder.getMetaHolder(); metaHolder.put(HEAD_KEY_TRAFFIC_TYPE.name(), PRESSURE); } Metadata metadata = TracingContextKey.getKeyMetadata().get(); if (metadata != null) { String s = metadata.get(HEAD_KEY_TRAFFIC_TYPE); if (PRESSURE.equals(s)) { currentSpan.getSofaTracerSpanContext().setBizBaggageItem(MARK, T); } } try { return invoker.invoke(request); } finally { MetadataHolder.clear(); } }  @Override SofaResponse invoke(FilterInvoker invoker, SofaRequest request); }
PressureMarkTransformFilter extends Filter { @Override public SofaResponse invoke(FilterInvoker invoker, SofaRequest request) throws SofaRpcException { SofaTracerSpan currentSpan = SofaTraceContextHolder.getSofaTraceContext().getCurrentSpan(); boolean loadTest = TracerUtils.isLoadTest(currentSpan); if (loadTest) { Map<String, String> metaHolder = MetadataHolder.getMetaHolder(); metaHolder.put(HEAD_KEY_TRAFFIC_TYPE.name(), PRESSURE); } Metadata metadata = TracingContextKey.getKeyMetadata().get(); if (metadata != null) { String s = metadata.get(HEAD_KEY_TRAFFIC_TYPE); if (PRESSURE.equals(s)) { currentSpan.getSofaTracerSpanContext().setBizBaggageItem(MARK, T); } } try { return invoker.invoke(request); } finally { MetadataHolder.clear(); } }  @Override SofaResponse invoke(FilterInvoker invoker, SofaRequest request); static final String PRESSURE; static final String MARK; static final String T; }