Skip to content
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

Add script version to worker trace events. #1445

Merged
merged 1 commit into from
Nov 30, 2023

Conversation

jp4a50
Copy link
Contributor

@jp4a50 jp4a50 commented Nov 28, 2023

No description provided.

@jp4a50 jp4a50 requested review from a team as code owners November 28, 2023 13:58
@jp4a50 jp4a50 requested review from mikea and hoodmane November 28, 2023 13:58
@@ -100,6 +102,7 @@ class TraceItem final: public jsg::Object {
kj::Maybe<kj::String> dispatchNamespace;
jsg::Optional<kj::Array<kj::String>> scriptTags;
kj::String outcome;
kj::Maybe<kj::String> scriptVersion;
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a comment a two about Maybe here? What does it mean? Not every script has a version? It is empty first and changed later?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It means not every script necessarily has a version. The same question could be asked of all the other Maybe fields here, so I think we should either add similar comments for all optional fields or none?

@@ -39,6 +39,7 @@ struct Trace @0x8e8d911203762d34 {

outcome @2 :EventOutcome;
scriptName @4 :Text;
scriptVersion @19 :Text;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should this be scriptVersionId to be most specific?

Copy link
Contributor Author

@jp4a50 jp4a50 Nov 28, 2023

Choose a reason for hiding this comment

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

Yeah, agree.

  • Update to scriptVersionId

@jp4a50 jp4a50 force-pushed the jphillips/trace-script-version branch from 6c1162f to ec08613 Compare November 29, 2023 19:04
@@ -71,6 +71,11 @@ class TraceItem final: public jsg::Object {
kj::ArrayPtr<jsg::Ref<TraceException>> getExceptions();
kj::ArrayPtr<jsg::Ref<TraceDiagnosticChannelEvent>> getDiagnosticChannelEvents();
kj::Maybe<kj::StringPtr> getScriptName();
// TODO(someday): we expose this as jsg::Optional for now, since that ensures that the property will
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@jasnell I've gone for this approach to "hide" the scriptVersionId property for now when it's not explicitly set. I did briefly consider making it a *_PROTOTYPE_PROPERTY instead to further "hide" it as they don't show up when calling Object.keys() but that seems like it would be weirdly inconsistent with the other properties here. LMK what you think.

Copy link
Member

Choose a reason for hiding this comment

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

This is fine I think.

@jp4a50 jp4a50 force-pushed the jphillips/trace-script-version branch from ec08613 to b7e14e6 Compare November 29, 2023 19:24
@jp4a50
Copy link
Contributor Author

jp4a50 commented Nov 29, 2023

Last push was rebase only.

@jp4a50 jp4a50 merged commit d794a1a into main Nov 30, 2023
11 checks passed
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.

4 participants