Skip to content

Commit

Permalink
more prometheus setup
Browse files Browse the repository at this point in the history
  • Loading branch information
prajjwalyd committed Jul 12, 2024
1 parent 44b1819 commit e604cd3
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 68 deletions.
2 changes: 1 addition & 1 deletion analytics/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
logger = logging.getLogger(__name__)

app = Flask(__name__)
metrics = PrometheusMetrics(app)
metrics = PrometheusMetrics(app, group_by='endpoint')
app.config['SQLALCHEMY_DATABASE_URI'] = 'postgresql://user:password@my-postgresql:5432/analytics-db'

try:
Expand Down
2 changes: 1 addition & 1 deletion api/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import logging

app = Flask(__name__)
metrics = PrometheusMetrics(app)
metrics = PrometheusMetrics(app, group_by='endpoint')

# Set up logging
logging.basicConfig(level=logging.DEBUG)
Expand Down
19 changes: 19 additions & 0 deletions prometheus.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
global:
scrape_interval: 15s

scrape_configs:
- job_name: 'api'
static_configs:
- targets: ['api-service:5000']

- job_name: 'url-shortener'
static_configs:
- targets: ['url-shortener-service:5001']

- job_name: 'qr-code-generator'
static_configs:
- targets: ['qr-code-generator-service:5002']

- job_name: 'analytics'
static_configs:
- targets: ['analytics-service:5003']
65 changes: 0 additions & 65 deletions test_integration.py

This file was deleted.

2 changes: 1 addition & 1 deletion url-shortener/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import string

app = Flask(__name__)
metrics = PrometheusMetrics(app)
metrics = PrometheusMetrics(app, group_by='endpoint')

# Function to generate a random short URL
def generate_short_url():
Expand Down

0 comments on commit e604cd3

Please sign in to comment.