Possible to enable X-Ray tracing with RestSharp

允我心安 提交于 2021-02-11 15:14:43

问题


We currently have an internal library that we're using to make a lot of our HTTP calls that uses RestSharp rather that the HttpClient to make all of our requests to downstream services. Is it possible to enable x-ray tracing in AWS without re-writing that library to instead use HttpClient? The goal is to get the same functionality that would be outlined here (when using HttpClient): https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-dotnet-httpclients.html


回答1:


The RestSharp library is a separate HTTP client which the X-Ray SDK for .NET does not support at this time. I'm not familiar with RestSharp, but I believe it uses HttpClient under the hood as that is the native library for HTTP calls in .NET. So if you could somehow replace the underlying HttpClient used by the RestSharp library with an instrumented version of HttpClient, that would enable X-Ray tracing, but I'm not sure if such a replacement is possible.

The X-Ray SDK for .NET is open sourced, and we're happy to take pull requests if you'd like to write a module for X-Ray RestSharp support https://github.com/aws/aws-xray-sdk-dotnet



来源:https://stackoverflow.com/questions/63523096/possible-to-enable-x-ray-tracing-with-restsharp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!