Skip to content

log sql queries.#35

Merged
stereosteve merged 1 commit intomainfrom
sp-query-logger
Apr 22, 2025
Merged

log sql queries.#35
stereosteve merged 1 commit intomainfrom
sp-query-logger

Conversation

@stereosteve
Copy link
Copy Markdown
Contributor

a log line looks like this:

{
  "level": "info",
  "ts": "2025-04-21T21:39:00.682-0400",
  "msg": "Query",
  "sql": "\n\t\tSELECT user_id FROM users \n\t\tWHERE\n\t\t\twallet = $1 \n\t\t\tAND is_current = true \n\t\tORDER BY handle_lc IS NOT NULL, created_at ASC \n\t\tLIMIT 1\n\t\t",
  "args": [
    "0x613d83f44970ead52afc256b4e81766304f1d0fc"
  ],
  "time": 0.044746625,
  "commandTag": "SELECT 1",
  "pid": 3054624
}

I think we could turn on for now since bridgerton is low traffic...
but disable when things are "getting real"?

questions:

  • do we want to change any fields before sending to axiom?

includes time
Copy link
Copy Markdown
Member

@raymondjacobson raymondjacobson left a comment

Choose a reason for hiding this comment

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

this looks good to me. is it possible to add the request url/route to it? that might be helpful

@raymondjacobson
Copy link
Copy Markdown
Member

as is im not sure how much more this gives us than the google cloud insights kinda thing

@stereosteve
Copy link
Copy Markdown
Contributor Author

as is im not sure how much more this gives us than the google cloud insights kinda thing

Probably most useful in dev... I already found an optimization opportunity with it here: #36

@stereosteve stereosteve merged commit c0ac99f into main Apr 22, 2025
2 checks passed
@raymondjacobson raymondjacobson deleted the sp-query-logger branch April 24, 2025 23:01
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