Skip to content

Commit

Permalink
Fix install requirements (socks, urllib3) + minor fixes (#90)
Browse files Browse the repository at this point in the history
Always install requests with socks
Added minimum version of urrlib3 to install_requirements
Do not retry on 500 errors
Fixed typo and minor bug in flatness analysis
  • Loading branch information
mmac-m3a authored Oct 21, 2021
1 parent 107e9ce commit 615ca71
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions kentik_api_library/kentik_api/analytics/flatness.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def flatness_analysis(
:param data: DataFrame indexed by time ("ts" column) containing columns "link" and "bytes_out" or "bps_out.
"link" column is expected to contain names of network links as <device_name>:<interface_name>
"bytes_out" columns (if present) is expected to contain total number of bytes transmitted via the link
"bps_out" column (if present) is expected to contain average outbound bandwith in bits/s for the link
"bps_out" column (if present) is expected to contain average outbound bandwidth in bits/s for the link
For "bytes_out" and "bps_out" the value is for a time period ending at the timestamp.
If the "bps_out" column is present it is used as the source for the analysis (regardless of presence of
"bytes_out")
Expand All @@ -374,7 +374,7 @@ def flatness_analysis(
log.debug("Computing bandwidth via each link")
if not has_uniform_datetime_index(data):
resolution = min_index_resolution(data).total_seconds()
log.info("Retrieved data have non-uniform sampling (min resolution: %f seconds) - resampling")
log.info("Retrieved data have non-uniform sampling (min resolution: %f seconds) - resampling", resolution)
data = resample_volume_data(data, f"{resolution}S")
link_bw = compute_link_bandwidth(data)
else:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

log = logging.getLogger(__name__)


# mypy: ignore-errors
class RetryableSession(Session):
DEFAULT_RETRY_STRATEGY = Retry(
total=3,
backoff_factor=1,
status_forcelist=[429, 500, 502, 503, 504],
status_forcelist=[429, 502, 503, 504],
allowed_methods=["DELETE", "HEAD", "GET", "PUT", "OPTIONS", "PATCH", "POST"],
)

Expand Down
2 changes: 1 addition & 1 deletion kentik_api_library/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run(self):
url="https://github.com/kentik/community_sdk_python/tree/main/kentik_api_library",
license="Apache-2.0",
include_package_data=True,
install_requires=["dacite>=1.6.0", "requests>=2.25.0", "typing-extensions>=3.7.4.3"],
install_requires=["dacite>=1.6.0", "requests[socks]>=2.25.0", "typing-extensions>=3.7.4.3", "urllib3>=1.26.0"],
setup_requires=["pytest-runner", "pylint-runner", "setuptools_scm", "wheel"],
tests_require=["httpretty", "pytest", "pylint"],
extras_require={
Expand Down

0 comments on commit 615ca71

Please sign in to comment.