{"repo":"NdoleStudio/go-otelroundtripper","free":true,"listed":false,"github":"https://github.com/NdoleStudio/go-otelroundtripper","clone":"git clone https://github.com/NdoleStudio/go-otelroundtripper.git","description":"Go http.RoundTripper that emits open telemetry metrics. This helps you easily get metrics for all external APIs you interact with.","language":"Go","stars":88,"topics":["opentelemetry-go","api-client","roundtripper","httpclient"],"license":"MIT","category":"api-integrations-sdks","readme_excerpt":"go-otelroundtripper This package provides an easy way to collect http related metrics (e.g Response times, Status Codes, number of in flight requests etc) for your HTTP API Clients. You can do this by using this round tripper when instantiating the http.Client{} . Why this package exists I currently have to integrate with multiple APIs and I needed a simple way to export metrics for those external API's. Sometimes external API's have their own SDK and the only input is http.Client . In this scenario, I can create an HTTP client with a round tripper automatically exports metrics according to the open telemetry specification. Installation go-otelroundtripper is compatible with modern Go releases in module mode, with Go installed: Alternatively the same can be achieved if you use import in a package: Usage This is a sample code that instantiates an HTTP client which sends requests to https://example.com . You can see a runnable example here Metrics Emitted The following metrics will be emitted by this package. Note that will be replaced by the prefix passed in WithName() . - .no request http calls with nil http.Request - .errors http requests which had an error response i.e err != nil - .success http requests which were successfull. Meaning there were no transport errors - .timeouts http requests which timed out - .cancelled http requests with cancelled context - .deadline exceeded http requests with context dateline exceeded - .total duration total time it takes to execute the ","default_branch":null,"files":null,"tree":[],"storefront":"/r/NdoleStudio","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/NdoleStudio/go-otelroundtripper/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}