Skip to content

Commit

Permalink
Reenable environment variables to set a proxy to be used by the colle…
Browse files Browse the repository at this point in the history
  • Loading branch information
fniessink committed Jun 10, 2020
1 parent 92efdd9 commit 21559e6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
6 changes: 3 additions & 3 deletions components/collector/src/base_collectors/metrics_collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ async def start(self) -> NoReturn:
max_sleep_duration = int(os.environ.get("COLLECTOR_SLEEP_DURATION", 60))
measurement_frequency = int(os.environ.get("COLLECTOR_MEASUREMENT_FREQUENCY", 15 * 60))
timeout = aiohttp.ClientTimeout(total=120)
async with aiohttp.ClientSession(timeout=timeout, raise_for_status=True) as session:
async with aiohttp.ClientSession(raise_for_status=True, timeout=timeout, trust_env=True) as session:
self.data_model = await self.fetch_data_model(session, max_sleep_duration)
while True:
self.record_health()
logging.info("Collecting...")
async with aiohttp.ClientSession(
timeout=timeout, connector=aiohttp.TCPConnector(limit_per_host=20),
raise_for_status=True) as session:
connector=aiohttp.TCPConnector(limit_per_host=20), raise_for_status=True, timeout=timeout,
trust_env=True) as session:
with timer() as collection_timer:
await self.collect_metrics(session, measurement_frequency)
sleep_duration = max(0, max_sleep_duration - collection_timer.duration)
Expand Down
4 changes: 4 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- Open the source links in separate window. Closes [#1203](https://github.com/ICTU/quality-time/issues/1203).

### Fixed

- Reenable environment variables to set a proxy to be used by the collector. See https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support. Fixes [#1217](https://github.com/ICTU/quality-time/issues/1217).

## [2.3.1] - [2020-06-02]

### Fixed
Expand Down
10 changes: 10 additions & 0 deletions docs/DEPLOY.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,13 @@ To configure the sleep duration and the measurement frequency, set the `COLLECTO
- COLLECTOR_SLEEP_DURATION=30
- COLLECTOR_MEASUREMENT_FREQUENCY=600
```

To configure a proxy for the collector to use, set the `HTTP_PROXY` or `HTTPS_PROXY` environment variable, for example:

```yaml
collector:
environment:
- HTTP_PROXY="http://proxy.com"
```

See the [aiohttp documentation](https://docs.aiohttp.org/en/stable/client_advanced.html#proxy-support) for more information on proxy support.

0 comments on commit 21559e6

Please sign in to comment.