Skip to content

Commit

Permalink
Minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
tlex committed Jan 26, 2020
1 parent 2aecb1d commit 9284d04
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 7 deletions.
1 change: 0 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
variables:
DOCKERHUB_REPO_NAME: grafana-email
# QUAY_REPO_NAME: grafana-email
ENABLE_ARM64: 'true'
ENABLE_ARMv7: 'true'
ENABLE_ARMv6: 'true'
Expand Down
3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM alpine:latest
LABEL maintainer="[email protected]"
LABEL maintainer="[email protected]" \
ai.ix.repository="ix.ai/etherscan-exporter"

WORKDIR /app

Expand Down
4 changes: 4 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh

echo "Setting VERSION='${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}' in src/constants.py"
echo "VERSION = '${CI_COMMIT_REF_NAME}-${CI_COMMIT_SHORT_SHA}'" >> src/constants.py
Empty file added src/__init__.py
Empty file.
5 changes: 5 additions & 0 deletions src/constants.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
""" Constants declarations """

VERSION = None
11 changes: 8 additions & 3 deletions src/grafana-email.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env python3
""" do shit """
""" Connects to Grafana and retrieves the panels, which are then sent per Email """

import logging
import os
Expand All @@ -12,6 +12,7 @@
import requests
from PIL import Image
import pygelf
import constants


LOG = logging.getLogger(__name__)
Expand All @@ -22,6 +23,8 @@
datefmt='%Y-%m-%d %H:%M:%S'
)

FILENAME = os.path.splitext(sys.modules['__main__'].__file__)[0]


def configure_logging():
""" Configures the logging """
Expand All @@ -30,7 +33,8 @@ def configure_logging():
host=os.environ.get('GELF_HOST'),
port=int(os.environ.get('GELF_PORT', 12201)),
debug=True,
include_extra_fields=True
include_extra_fields=True,
_ix_id=FILENAME
)
LOG.addHandler(GELF)
LOG.info('Initialized logging with GELF enabled')
Expand Down Expand Up @@ -172,7 +176,8 @@ def send_email(self):

if __name__ == '__main__':
configure_logging()
LOG.info("Starting")
# pylint: disable=no-member
LOG.info("Starting {} {}".format(FILENAME, constants.VERSION))
grafana = GrafanaEmail()
grafana.get_panels()
grafana.send_email()
4 changes: 2 additions & 2 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
requests==2.22.0
pygelf==0.3.6
requests
pillow
pillow>=6.2.1

0 comments on commit 9284d04

Please sign in to comment.