Skip to content

Commit

Permalink
Merge pull request #2 from spreaker/enable-python-faulthandler-on-pro…
Browse files Browse the repository at this point in the history
…metheus-jenkins-exporter

Enable python faulthandler and introduce a Docker-base dev environment
  • Loading branch information
Marco Pracucci authored Jul 25, 2018
2 parents 55bc641 + 2456829 commit 7af2369
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
dist
MANIFEST
prometheus_jenkins_exporter.egg-info
__pycache__/
11 changes: 11 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM alpine:3.8

# Installing required packages
RUN apk add --update --no-cache \
python3

# Install dependencies
COPY requirements.txt /workspace/prometheus-jenkins-exporter/requirements.txt
RUN cd /workspace/prometheus-jenkins-exporter && pip3 install -r requirements.txt

WORKDIR /workspace/prometheus-jenkins-exporter
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ jenkins_plugins_enabled_with_update_count

## Contributions

### Run the development environment

```
docker-compose build && docker-compose run dev sh
```

### Ensure the code is PEP 8 compliant

`pycodestyle --max-line-length=180 prometheus_jenkins_exporter/*.py`
Expand Down
12 changes: 12 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: "3"

services:
dev:
build:
context: .
dockerfile: Dockerfile
command: [ "sh" ]
ports:
- 8000:8000
volumes:
- /workspace/prometheus-jenkins-exporter:/workspace/prometheus-jenkins-exporter:delegated
5 changes: 5 additions & 0 deletions prometheus_jenkins_exporter/exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@
import time
import os
import signal
import faulthandler
from urllib.parse import urlencode, quote_plus
from prometheus_client import start_http_server
from prometheus_client.core import GaugeMetricFamily, REGISTRY
import logging
from pythonjsonlogger import jsonlogger


# Enable dumps on stderr in case of segfault
faulthandler.enable()


class JenkinsApiClient():
def __init__(self, config):
self.config = config
Expand Down

0 comments on commit 7af2369

Please sign in to comment.