-
Notifications
You must be signed in to change notification settings - Fork 722
❇️ Ozone user agent #3991
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
❇️ Ozone user agent #3991
Conversation
"type": "string", | ||
"description": "Name/identifier of the source (e.g., 'automod', 'ozone/workspace')" | ||
}, | ||
"extra": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
extra
works for me, though I also wonder if something more neutral about the info's "extra-ness" like details
could also be good.
"name": { | ||
"type": "string", | ||
"description": "Name/identifier of the source (e.g., 'automod', 'ozone/workspace')" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume also using an actual user-agent string (in this sense) would also be welcome.
"userAgent": { | ||
"type": "ref", | ||
"ref": "tools.ozone.moderation.defs#userAgent" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My only confusion about this kind of usage is that there is also the user-agent
header which will be present in these requests.
@@ -1,5 +1,6 @@ | |||
import { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May be worth a changeset for this dev-env change.
userAgent: row.userAgent | ||
? { | ||
name: row.userAgent.name, | ||
extra: row.userAgent.extra as { [x: string]: unknown } | undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this cast be addressed by updating the type in the moderation_event
schema?
await db.schema | ||
.createIndex('moderation_event_user_agent_name_idx') | ||
.on('moderation_event') | ||
.expression(sql`("userAgent" ->> 'name')`) | ||
.execute() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If many events end-up being created by the same system, with the same user agent name, even this index may not save us! Do we think that is likely? What is the most similar use case in queryEvents
(where I assume this index is used) and how is it indexed?
This PR adds an optional
userAgent
property to moderation events, allowing for better tracing of where events are coming from. The primary property of the userAgent object is just aname
string while it allows for any additional metadata passing via theextra
object.