Skip to content

Commit

Permalink
Merge pull request #314 from idealista/develop
Browse files Browse the repository at this point in the history
Release 4.2.0
  • Loading branch information
smartinsempere authored Oct 5, 2022
2 parents a9898c8 + 21d7b28 commit d8d5952
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ 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)
## [4.2.0](https://github.com/idealista/prom2teams/tree/4.2.0)
[Full Changelog](https://github.com/idealista/prom2teams/compare/4.1.0...4.2.0)
### Added
- *[#312](https://github.com/idealista/prom2teams/pull/312) Improve error handler to distinguish between different kind of exceptions* @smartinsempere
## [4.1.0](https://github.com/idealista/prom2teams/tree/4.1.0)
[Full Changelog](https://github.com/idealista/prom2teams/compare/4.0.0...4.1.0)
### Fixed
Expand Down
2 changes: 1 addition & 1 deletion helm/Chart.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: v1
appVersion: "3.2.3"
appVersion: "4.2.0"
description: A Helm chart for Prom2Teams
name: prom2teams
version: 0.2.0
12 changes: 11 additions & 1 deletion prom2teams/app/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
import os

from flask import Flask, Blueprint, send_from_directory
from marshmallow.exceptions import ValidationError

from prom2teams.app.configuration import config_app, setup_logging
from .exceptions import MicrosoftTeamsRequestException
from .versions.v1 import api_v1
from .versions.v1.namespace import ns as ns_v1
from .versions.v2 import api_v2
Expand All @@ -13,26 +15,33 @@

app = Flask(__name__)


@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'favicon.ico', mimetype='image/vnd.microsoft.icon')


@app.route('/alive')
def alive():
return "YES", 200


@app.route('/ready')
def ready():
return ("YES", 200) if app.config['FINISH_INIT'] else ("NO", 503)


def error_handler(e):
msg = 'An unhandled exception occurred. {}'.format(e)
log.exception(msg)
if isinstance(e, MicrosoftTeamsRequestException):
return str(e), e.code
if isinstance(e, ValidationError):
return str(e), 400
return str(e), 500



def register_api(application, api, namespace, blueprint):
api.init_app(blueprint)
api.add_namespace(namespace)
Expand All @@ -50,5 +59,6 @@ def init_app(application):
application.register_error_handler(500, error_handler)
application.config['FINISH_INIT'] = True


init_app(app)
log.info('{} started on {}:{}'.format(app.config['APP_NAME'], app.config['HOST'], app.config['PORT']))
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


setup(name='prom2teams',
version='3.3.0',
version='4.2.0',
description='Project that redirects Prometheus Alert Manager '
'notifications to Microsoft Teams',
long_description=readme,
Expand Down

0 comments on commit d8d5952

Please sign in to comment.