Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions manifests/00-miscellanea-OPTIONAL.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ spec:
# Clone repository
echo "Cloning repository..."
cd /tmp
git clone --branch scripts --single-branch https://github.com/opencitations/oc_statistics.git
git clone --branch scripts-v2 --single-branch https://github.com/opencitations/oc_statistics.git
cd oc_statistics

# Install Python dependencies from repository
Expand Down Expand Up @@ -284,6 +284,12 @@ spec:
if [ $? -eq 0 ]; then
echo "✓ CSV file generated successfully"
echo "Size: $(du -h ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv | cut -f1)"

# Compress CSV
gzip -c ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv > ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv.gz
echo "✓ Compressed CSV: $(du -h ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv.gz | cut -f1)"
rm ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv

else
echo "✗ ERROR: Failed to generate CSV file"
exit 1
Expand All @@ -292,9 +298,9 @@ spec:
# Step 2: Convert CSV to Prometheus format
echo ""
echo "Step 2: Converting CSV to Prometheus format..."
echo "Command: python3.12 ./02-log_to_prometheus/log_to_prom.py ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv -o ${PUBLIC_LOGS_DIR}/prom/oc-${YEAR}-${MONTH}.prom"
echo "Command: python3.12 ./02-log_to_prometheus/log_to_prom.py ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv.gz -o ${PUBLIC_LOGS_DIR}/prom/oc-${YEAR}-${MONTH}.prom"

python3.12 ./02-log_to_prometheus/log_to_prom.py ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv -o ${PUBLIC_LOGS_DIR}/prom/oc-${YEAR}-${MONTH}.prom
python3.12 ./02-log_to_prometheus/log_to_prom.py ${PUBLIC_LOGS_DIR}/csv/oc-${YEAR}-${MONTH}.csv.gz -o ${PUBLIC_LOGS_DIR}/prom/oc-${YEAR}-${MONTH}.prom

if [ $? -eq 0 ]; then
echo "✓ Prometheus file generated successfully"
Expand Down
20 changes: 17 additions & 3 deletions manifests/03-varnish-rediscache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -412,9 +412,23 @@ data:

# Handle backend responses
sub vcl_backend_response {
# Handle 4xx and 5xx responses
if (beresp.status >= 400) {
set beresp.ttl = 200s;
# Do not cache 429
if (beresp.status == 429) {
set beresp.uncacheable = true;
return (deliver);
}

# Cache 5xx for 5 seconds
if (beresp.status >= 500 && beresp.status < 600) {
set beresp.ttl = 5s;
set beresp.grace = 0s;
set beresp.keep = 0s;
return (deliver);
}

# Cache other 4xx
if (beresp.status >= 400 && beresp.status < 500) {
set beresp.ttl = 10s;
set beresp.grace = 0s;
set beresp.keep = 0s;
return (deliver);
Expand Down
Loading