Skip to content

Commit

Permalink
Merge branch 'develop' into fix/228
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelogalmor authored Aug 2, 2022
2 parents f190ebc + d3712cb commit 5507799
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 8 deletions.
15 changes: 14 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ os: linux
dist: bionic
language: python

dist: focal

services:
- docker

python:
- '3.7'
- '3.8'
- '3.9'
- '3.10'

env:
- DOCKER_COMPOSE_VERSION=1.27.3
Expand Down Expand Up @@ -42,3 +44,14 @@ jobs:
on:
tags: true
skip_existing: true
- stage: Deploy to DockerHub
before_deploy:
- docker login -u "$DOCKER_USERNAME" -p "$DOCKER_PASSWORD"
- docker build -t prom2teams .
- docker tag prom2teams $DOCKER_USERNAME/prom2teams:latest
- docker tag prom2teams $DOCKER_USERNAME/prom2teams:$TRAVIS_TAG
deploy:
provider: script
script: docker push $DOCKER_USERNAME/prom2teams:$TRAVIS_TAG && docker push $DOCKER_USERNAME/prom2teams:latest
on:
tags: true
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,15 @@ All notable changes to this project will be documented in this file.
This project adheres to [Semantic Versioning](http://semver.org/) and [Keep a changelog](https://github.com/olivierlacan/keep-a-changelog).

## [Unreleased](https://github.com/idealista/prom2teams/tree/develop)

## [3.3.0](https://github.com/idealista/prom2teams/tree/3.3.0)
[Full Changelog](https://github.com/idealista/prom2teams/compare/3.2.3...3.3.0)
### Fixed
- *[#290](https://github.com/idealista/prom2teams/pull/290) Fixed .travis.yml config file and added to requirements.txt some missing dependencies.* @ommarmol
- *[#279](https://github.com/idealista/prom2teams/pull/279) Fixed issue with MS Teams exception handling* @nryabkov
### Added
- *[#281](https://github.com/idealista/prom2teams/pull/281) Allow to add arbitrary envvars to deployment* @dkobras
- *[#292](https://github.com/idealista/prom2teams/issues/292) Configurable timeout for the request* @blalop

## [3.2.3](https://github.com/idealista/prom2teams/tree/3.2.3)
[Full Changelog](https://github.com/idealista/prom2teams/compare/3.2.2...3.2.3)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,7 @@ Excluded: <Comma separated list of labels to ignore>
Excluded: <Comma separated list of annotations to ignore>

[Teams Client]
RequestTimeout: <Configures the request timeout> # defaults to 30 secs
RetryEnable: <Enables teams client retry policy> # defaults to false
RetryWaitTime: <Wait time between retries> # default: 60 secs
MaxPayload: <Teams client payload limit in bytes> # default: 24KB
Expand Down
1 change: 1 addition & 0 deletions prom2teams/app/configuration.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def _update_application_configuration(application, configuration):
application.config['MICROSOFT_TEAMS'] = configuration['Microsoft Teams']
if 'Microsoft Teams Client' in configuration:
application.config['TEAMS_CLIENT_CONFIG'] = {
'TIMEOUT': configuration.getint('Microsoft Teams Client', 'RequestTimeout'),
'RETRY_ENABLE': configuration.getboolean('Microsoft Teams Client', 'RetryEnable'),
'RETRY_WAIT_TIME': configuration.getint('Microsoft Teams Client', 'RetryWaitTime'),
'MAX_PAYLOAD': configuration.getint('Microsoft Teams Client', 'MaxPayload')
Expand Down
4 changes: 3 additions & 1 deletion prom2teams/app/teams_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

class TeamsClient:
DEFAULT_CONFIG = {
'TIMEOUT': 30,
'MAX_PAYLOAD': 24576,
'RETRY_ENABLE': False,
'RETRY_WAIT_TIME': 60
Expand All @@ -22,6 +23,7 @@ def __init__(self, config=None):
if config is None:
config = {}
config = {**TeamsClient.DEFAULT_CONFIG, **config}
self.timeout = config['TIMEOUT']
self.max_payload_length = config['MAX_PAYLOAD']
self.retry = config['RETRY_ENABLE']
self.wait_time = config['RETRY_WAIT_TIME']
Expand All @@ -41,7 +43,7 @@ def simple_post(teams_webhook_url, message):
simple_post(teams_webhook_url, message)

def _do_post(self, teams_webhook_url, message):
response = self.session.post(teams_webhook_url, data=message, timeout=(5,20))
response = self.session.post(teams_webhook_url, data=message, timeout=self.timeout)
if not response.ok or response.text != '1':
exception_msg = 'Error performing request to: {}.\n' \
' Returned status code: {}.\n' \
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ marshmallow==3.0.0rc6
jinja2==2.11.3
Flask==1.0.2
pyyaml==5.4
uwsgi==2.0.16
uwsgi==2.0.20
prometheus_flask_exporter==0.9.0
werkzeug==0.16.1
DeepDiff==4.3.0
zipp==1.2.0
zipp==3.1.0
MarkupSafe==1.1.1
pyrsistent==0.16.0
tenacity==6.2.0
Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


setup(name='prom2teams',
version='3.2.3',
version='3.3.0',
description='Project that redirects Prometheus Alert Manager '
'notifications to Microsoft Teams',
long_description=readme,
Expand Down Expand Up @@ -45,8 +45,8 @@
'Intended Audience :: System Administrators',
'Topic :: System :: Monitoring',
'Programming Language :: Python',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10'
],
zip_safe=False)

0 comments on commit 5507799

Please sign in to comment.