Skip to content

comments#7

Open
tombokombo wants to merge 1 commit intomainfrom
comments
Open

comments#7
tombokombo wants to merge 1 commit intomainfrom
comments

Conversation

@tombokombo
Copy link
Copy Markdown

No description provided.

Comment thread app/main.py

# Global config
REDIS_PREFIX = "metric:"
REDIS_PREFIX = "metric:" #ENV VAR!?
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread app/main.py
DEFAULT_TTL = int(os.getenv("DEFAULT_TTL", "7200")) # 2 hours

logging.basicConfig(level=logging.INFO)
logging.basicConfig(level=logging.INFO) # LOGLEVEL SET VIA ENV VAR?! OR -v -vv -vvv...
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done via env var

Comment thread app/main.py

def _parse_ttl(labels: Dict[str, str]) -> int:
ttl_label = "pushgw_ttl"
ttl_label = "pushgw_ttl" #NAMING CONSITENCY pushgw vs pushgateway
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done with backward compatibility

Comment thread app/main.py
@asynccontextmanager
async def lifespan(app: FastAPI) -> AsyncIterator[None]:
global redis_client
global redis_client # must be global var? cannot be passed as param to this async func? global client is ok, but not global variable
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread app/main.py

for key in keys:
if await redis_client.type(key) != "string":
if await redis_client.type(key) != "string": # type checking via string? is there somthing like redis.STRING to compare with?
Copy link
Copy Markdown
Contributor

@maso7 maso7 Aug 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done, there is no such option as redis.STRING

Comment thread app/main.py
metrics_by_name[name].append((labels, value))
type_by_name[name] = mtype
except Exception:
# log execetion every time, now it makes you blind
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread app/main.py
filtered = {k: labels.get(k, "") for k in label_keys}
g.labels(**filtered).set(value)
except ValueError:
# log execetion every time, now it makes you blind, but less then case before, because it was generic exception
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment thread app/main.py

return PlainTextResponse(internal_metrics + redis_metrics, media_type="text/plain")

#LOGGING IN BETWEEN WITH DEBUG LEVEL
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants