Skip to content

Commit

Permalink
chore: added new env variables for workhours
Browse files Browse the repository at this point in the history
  • Loading branch information
akimrx committed Jul 2, 2023
1 parent 65fb901 commit c643471
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ run_migration
| `EXPORTER_CLICKHOUSE_DATABASE` | ❌ | `agile` | Database for exporter CH tables |
| `EXPORTER_CLICKHOUSE_ISSUES_TABLE` | ❌ | `issues` | Table when store issues metadata |
| `EXPORTER_CLICKHOUSE_ISSUE_METRICS_TABLE` | ❌ | `issue_metrics` | Table when store issue metrics |
| `EXPORTER_WORKHOURS_START` | ❌ | 9 | The beginning of working hours for calculating business hour metrics |
| `EXPORTER_WORKHOURS_END` | ❌ | 22 | The end of working hours for calculating business hour metrics |
# Monitoring
Expand Down
8 changes: 6 additions & 2 deletions tracker_exporter/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,13 @@
UPLOAD_TO_STORAGE = os.environ.get("EXPORTER_ENABLE_UPLOAD", "false").lower() in ("true", "yes")

# Business days settings
BUSINESS_HOURS_START = dt.time(9)
BUSINESS_HOURS_END = dt.time(22)
WORKDAYS = [0, 1, 2, 3, 4] # From Monday to Friday
try:
BUSINESS_HOURS_START = dt.time(int(os.environ.get("EXPORTER_WORKHOURS_START", "9")))
BUSINESS_HOURS_END = dt.time(int(os.environ.get("EXPORTER_WORKHOURS_END", "22")))
except (ValueError, TypeError):
BUSINESS_HOURS_START = dt.time(9)
BUSINESS_HOURS_END = dt.time(22)

# Monitoring settings
MONITORING_ENABLED = os.environ.get("EXPORTER_MONITORING_ENABLED", "false").lower() in ("true", "yes")
Expand Down

0 comments on commit c643471

Please sign in to comment.