Skip to content

Commit f5eb8f8

Browse files
committed
Update README.md and httpclient_rate_handler.go
1 parent 8065bf5 commit f5eb8f8

File tree

2 files changed

+38
-30
lines changed

2 files changed

+38
-30
lines changed

README.md

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,39 @@
1-
# Template
2-
3-
This repository serves as a **Default Template Repository** according official [GitHub Contributing Guidelines][ProjectSetup] for healthy contributions. It brings you clean default Templates for several areas:
4-
5-
- [Azure DevOps Pull Requests](.azuredevops/PULL_REQUEST_TEMPLATE.md) ([`.azuredevops\PULL_REQUEST_TEMPLATE.md`](`.azuredevops\PULL_REQUEST_TEMPLATE.md`))
6-
- [Azure Pipelines](.pipelines/pipeline.yml) ([`.pipelines/pipeline.yml`](`.pipelines/pipeline.yml`))
7-
- [GitHub Workflows](.github/workflows/)
8-
- [Super Linter](.github/workflows/linter.yml) ([`.github/workflows/linter.yml`](`.github/workflows/linter.yml`))
9-
- [Sample Workflows](.github/workflows/workflow.yml) ([`.github/workflows/workflow.yml`](`.github/workflows/workflow.yml`))
10-
- [GitHub Pull Requests](.github/PULL_REQUEST_TEMPLATE.md) ([`.github/PULL_REQUEST_TEMPLATE.md`](`.github/PULL_REQUEST_TEMPLATE.md`))
11-
- [GitHub Issues](.github/ISSUE_TEMPLATE/)
12-
- [Feature Requests](.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md) ([`.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md`](`.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md`))
13-
- [Bug Reports](.github/ISSUE_TEMPLATE/BUG_REPORT.md) ([`.github/ISSUE_TEMPLATE/BUG_REPORT.md`](`.github/ISSUE_TEMPLATE/BUG_REPORT.md`))
14-
- [Codeowners](.github/CODEOWNERS) ([`.github/CODEOWNERS`](`.github/CODEOWNERS`)) _adjust usernames once cloned_
15-
- [Wiki and Documentation](docs/) ([`docs/`](`docs/`))
16-
- [gitignore](.gitignore) ([`.gitignore`](.gitignore))
17-
- [gitattributes](.gitattributes) ([`.gitattributes`](.gitattributes))
18-
- [Changelog](CHANGELOG.md) ([`CHANGELOG.md`](`CHANGELOG.md`))
19-
- [Code of Conduct](CODE_OF_CONDUCT.md) ([`CODE_OF_CONDUCT.md`](`CODE_OF_CONDUCT.md`))
20-
- [Contribution](CONTRIBUTING.md) ([`CONTRIBUTING.md`](`CONTRIBUTING.md`))
21-
- [License](LICENSE) ([`LICENSE`](`LICENSE`)) _adjust projectname once cloned_
22-
- [Readme](README.md) ([`README.md`](`README.md`))
23-
- [Security](SECURITY.md) ([`SECURITY.md`](`SECURITY.md`))
1+
# Go API HTTP Client
242

3+
This Go module offers a sophisticated HTTP client designed for seamless API interactions, with a strong emphasis on concurrency management, robust error handling, extensive logging, and adaptive rate limiting. It's particularly suitable for applications requiring high-throughput API interactions with complex authentication and operational resilience.
4+
5+
## Features
6+
7+
- **Comprehensive Authentication Support**: Robust support for various authentication schemes, including OAuth and Bearer Token, with built-in token management and validation.
8+
- **Advanced Concurrency Management**: An intelligent Concurrency Manager dynamically adjusts concurrent request limits to optimize throughput and adhere to API rate limits.
9+
- **Structured Error Handling**: Clear and actionable error reporting facilitates troubleshooting and improves reliability.
10+
- **Performance Monitoring**: Detailed performance metrics tracking provides insights into API interaction efficiency and optimization opportunities.
11+
- **Configurable Logging**: Extensive logging capabilities with customizable levels and formats aid in debugging and operational monitoring.
12+
- **Adaptive Rate Limiting**: Dynamic rate limiting automatically adjusts request rates in response to API server feedback.
13+
- **Flexible Configuration**: Extensive customization of HTTP client behavior to meet specific API requirements, including custom timeouts, retry strategies, header management, and more.
14+
- **Header Management**: Easy and efficient management of HTTP request headers, ensuring compliance with API requirements.
15+
- **Enhanced Logging with Zap**: Utilizes Uber's zap library for structured, high-performance logging, offering levels from Debug to Fatal, including structured context and dynamic adjustment based on the environment.
16+
17+
18+
## Getting Started
19+
20+
### Installation
21+
22+
To use this HTTP client in your project, add the package to your Go module dependencies:
23+
24+
```bash
25+
go get github.com/yourusername/go-api-http-client
26+
```
27+
28+
### Usage
29+
Import the package and configure the client according to your API's needs:
2530

2631
## Status
2732

2833
[![Super Linter](<https://github.com/segraef/Template/actions/workflows/linter.yml/badge.svg>)](<https://github.com/segraef/Template/actions/workflows/linter.yml>)
2934

3035
[![Sample Workflow](<https://github.com/segraef/Template/actions/workflows/workflow.yml/badge.svg>)](<https://github.com/segraef/Template/actions/workflows/workflow.yml>)
3136

32-
## Creating a repository from a template
33-
34-
You can [generate](https://github.com/segraef/Template/generate) a new repository with the same directory structure and files as an existing repository. More details can be found [here][CreateFromTemplate].
3537

3638
## Reporting Issues and Feedback
3739

httpclient/httpclient_rate_handler.go

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,16 @@
33
/*
44
Components:
55
6-
Backoff Strategy: A function that calculates the delay before the next retry. It will implement exponential backoff with jitter. This strategy is more effective than a fixed delay, as it ensures that in cases of prolonged issues, the client won't keep hammering the server with a high frequency.
7-
Response Time Monitoring: We'll introduce a mechanism to track average response times and use deviations from this average to inform our backoff strategy.
8-
Error Classifier: A function to classify different types of errors. Only transient errors should be retried.
9-
Rate Limit Header Parser: For future compatibility, a function that can parse common rate limit headers (like X-RateLimit-Remaining and Retry-After) and adjust behavior accordingly.
6+
Backoff Strategy: A function that calculates the delay before the next retry. It will
7+
implement exponential backoff with jitter. This strategy is more effective than a fixed
8+
delay, as it ensures that in cases of prolonged issues, the client won't keep hammering
9+
the server with a high frequency.
10+
Response Time Monitoring: We'll introduce a mechanism to track average response times and
11+
use deviations from this average to inform our backoff strategy.
12+
Error Classifier: A function to classify different types of errors. Only transient errors
13+
should be retried.Rate Limit Header Parser: For future compatibility, a function that can
14+
parse common rate limit headers (like X-RateLimit-Remaining and Retry-After) and adjust
15+
behavior accordingly.
1016
1117
*/
1218

0 commit comments

Comments
 (0)