Skip to content

Commit

Permalink
fix: loki logs in workflow web (#117)
Browse files Browse the repository at this point in the history
* fix(workflow-run-loki): add logic to add pipeline and site to the loki tags

workflow web wasn't able to find the logs for Work since the relevant tags were missing from the Loki logs. It also appears that the python driver may not accept logs that do not have any tags at all.

* refactor(chimefrb-workspace): add loki tags config to workspace

this is currently a empty object since I couldn't think of any useful static tags to add to the logs.
  • Loading branch information
tjzegmott committed Sep 6, 2024
1 parent a3a1cab commit 8ea12d9
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
23 changes: 23 additions & 0 deletions workflow/cli/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,29 @@ def run(
"[bold red]Backend Checks [/bold red]",
extra=dict(markup=True, color="green"),
)
# Add pipeline and site to loki tags
if config.get("logging", {}).get("loki", {}).get("tags", {}):
# Loki tags exist, add pipeline and site
config["logging"]["loki"]["tags"].update(
{
# Assumes that there is only one bucket
"pipeline": buckets[0],
"site": site,
}
)
else:
# Missing Logging config in Workspace
config.update({
"logging": {
"loki": {
"tags": {
# Assumes that there is only one bucket
"pipeline": buckets[0],
"site": site,
}
}
}
})
loki_status: bool = configure.loki(logger=logger, config=config)
logger.info(f"Loki Logs: {'✅' if loki_status else '❌'}")
http: HTTPContext = HTTPContext(backends=["buckets"])
Expand Down
4 changes: 4 additions & 0 deletions workflow/workspaces/chimefrb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -104,3 +104,7 @@ deployers:
chime:
docker:
client_url: tcp://frb-vsop.chime:2375

logging:
loki:
tags: {}

0 comments on commit 8ea12d9

Please sign in to comment.