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

feat: Add support for event body fields #297

Merged
merged 8 commits into from
Sep 20, 2024

Conversation

MSNev
Copy link
Contributor

@MSNev MSNev commented Aug 7, 2024

Adds support for the event body fields reusing the existing event type.

  • Supports existing event (Span) definition
  • Supports the log based event definition as an extension of the existing span definition
  • Adds Body (optional) definition which supports a collection of fields or a single string value
    • Body has a type of string or map
    • An optional brief (required for string type)
    • An optional note
    • An optional stability
    • An optional examples (required for string type)

@MSNev
Copy link
Contributor Author

MSNev commented Aug 7, 2024

The PR supersedes #236 as discussed in tools sigs this morning.

defaults/jq/semconv.jq Outdated Show resolved Hide resolved
defaults/jq/semconv.jq Outdated Show resolved Hide resolved
Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

This PR represents a lot of work and is overall really good. However, my main concern is the lack of alignment between the concept of a body field and the concept of embedded/aliased attributes. Depending on how this discussion ends, the implications for this PR could be more or less significant.

crates/weaver_forge/src/registry.rs Outdated Show resolved Hide resolved
crates/weaver_forge/src/registry.rs Outdated Show resolved Hide resolved
crates/weaver_resolved_schema/src/body.rs Outdated Show resolved Hide resolved
crates/weaver_resolved_schema/src/body.rs Outdated Show resolved Hide resolved
crates/weaver_resolved_schema/src/body.rs Outdated Show resolved Hide resolved
crates/weaver_resolved_schema/src/body.rs Outdated Show resolved Hide resolved
crates/weaver_resolved_schema/src/body.rs Outdated Show resolved Hide resolved
crates/weaver_resolver/src/attribute.rs Outdated Show resolved Hide resolved
crates/weaver_semconv/src/group.rs Outdated Show resolved Hide resolved
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_semconv/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_resolver/src/body.rs Fixed Show fixed Hide fixed
crates/weaver_resolver/src/body.rs Fixed Show fixed Hide fixed
@MSNev MSNev force-pushed the MSNev/EventBody branch 3 times, most recently from 5111ee7 to 42b7a6c Compare August 9, 2024 22:44
@trisch-me trisch-me requested a review from a team August 12, 2024 14:48
@MSNev MSNev force-pushed the MSNev/EventBody branch 4 times, most recently from 6832983 to 88ac690 Compare August 14, 2024 14:04
@MSNev MSNev requested a review from a team August 16, 2024 21:13
@MSNev
Copy link
Contributor Author

MSNev commented Sep 17, 2024

Please also see comments and discussion topics in #365

@MSNev
Copy link
Contributor Author

MSNev commented Sep 18, 2024

AnyValue PR and this PR now have the same (common) set of changes.

Copy link
Contributor

@jsuereth jsuereth 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 now.

I'm still unhappy with the direction our tests have been going in and I'd much prefer finer-grained, feature or regresison focused tests, but we can clean that up later.

Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

@MSNev, @jsuereth I haven’t finished the review, but I will do it in a few hours after my meetings. In the meantime, I’m posting some of my preliminary comments. This is definitely heading in the right direction!


{% for event in ctx.events %}
## Event `{{ event.name }}`
## Event `{{ event.id }}`
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question: Why using id and not name here?
Not blocking.

Copy link
Contributor Author

@MSNev MSNev Sep 20, 2024

Choose a reason for hiding this comment

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

Actually, the top level "name" will still exist on the event type, its just the AnyValues that will now only have the id (and no name), and this is just local test code.

| map(. + {
event_namespace: (if .id | index(".") then (.id | split(".") | .[0:-1] | join(".")) else "other" end)
})
| sort_by(.event_namespace, .id)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just a question: Why use event_namespace instead of root_namespace, as with the other signals? I just want to avoid the same kind of issues we had in the past with name and metric_name, which made it harder to generalize without providing significantly higher value for the UX.

Not blocking.

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to this from me. We should avoid diverging here, although IIUC this is just testing code right?

We can clean this up 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.

Yes, it is just testing code. And for events the entire "event_namespace" is important and not just the "root_namespace"...

Copy link
Contributor

@lquerel lquerel left a comment

Choose a reason for hiding this comment

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

Once the merge with the other PR (AnyValueSpec) is done, and the few minor corrections mentioned in my comments are made, I see no problem with creating a release with this PR. Please update the CHANGELOG.md to announce the support of events in Weaver (section [Next]).

However, as a precaution, I think it would be a good idea to check the backward compatibility with the older registries. The previous version was able to check all versions from 1.21.0 to the latest one. You can test each version with the following command line.

cargo run -- registry check -r https://github.com/open-telemetry/semantic-conventions/archive/refs/tags/v1.21.0.zip[model]

Thanks for all your hard work on this!

@@ -490,6 +491,73 @@ impl Examples {
),
}
}

/// Validation logic for the any_value.
pub(crate) fn validate_any_value(
Copy link
Contributor

Choose a reason for hiding this comment

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

Why is this function in the attribute.rs file instead of any_value.rs?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I kept it here with the other "Examples" validate so that there was only one location for handling "Examples"...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Local backward compat check past with the expected warnings about examples SHOULD be of type string[]

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. So we are ready to go?

…resolved schema

- simplify validate_any_value_examples
- Reduce the test yaml events to smaller set
- Removed observed file
@lquerel lquerel merged commit 3192be4 into open-telemetry:main Sep 20, 2024
22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants