可以使用RestSharp启用X射线跟踪 [英] Possible to enable X-Ray tracing with RestSharp

查看:105
本文介绍了可以使用RestSharp启用X射线跟踪的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们目前有一个内部库,我们正在使用该库进行许多HTTP调用,这些调用使用RestSharp而不是HttpClient来向下游服务发出所有请求.是否可以在AWS中启用X射线跟踪而无需重写该库以改为使用HttpClient?目标是获得与此处概述(使用HttpClient时)相同的功能: https://docs.aws.amazon.com/xray/latest/devguide/xray-sdk-dotnet-httpclients.html

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

推荐答案

RestSharp库是一个单独的HTTP客户端,目前.NET X-Ray SDK不支持该客户端.我不熟悉RestSharp,但我相信它在幕后使用HttpClient,因为那是.NET中HTTP调用的本机库.因此,如果您可以用工具版本的HttpClient替换RestSharp库使用的基础HttpClient,则可以启用X-Ray跟踪,但是我不确定是否可以进行这种替换.

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.

.NET的X-Ray SDK是开源的,如果您想编写一个支持X-Ray RestSharp的模块,我们很高兴提出拉取请求.com/aws/aws-xray-sdk-dotnet"rel =" nofollow noreferrer> https://github.com/aws/aws-xray-sdk-dotnet

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

这篇关于可以使用RestSharp启用X射线跟踪的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆