- 
                Notifications
    
You must be signed in to change notification settings  - Fork 933
 
Description
This is a proposal to add EventName of type string as a field in the data model instead of having it just a event.name string attribute defined in semantic conventions.
Related to:
- Add EventName parameter to Logger.Enabled #4220
 - Add 
Event Enabledoperation toLogger#4263 - Add EmitEvent to Logs API #4259
 
Consequences
- Currently, we have no control what type of value would be set to 
event.name(e.g. by log bridges). Promoting it to a field with a concrete type would make the design more type-safe. So far my understanding is that most people would like to have it asstring. On the other hand, there are some cases where users would like to have something different or more lightweight. Personally, I think settling on a concrete "type" is better than having something very generic and abstract. I think that havingEventIdofanytype is nothing better than havingevent.namedefined in semantic conventions. I would consider havingEventIdof an integer type (instead ofEventNameas string) for performance reasons; yet this can be tracked separate issue. 
It is very important (actually the EventId, the numerical, machine friendly version of EventName that is most important to do ultra fast checks!) for scenarios we are working on in OTel Rust, C++. I don't know if it is something every language/implementation cares about. Given spec does not prohibit an implementation from allowing more parameters, I am totally okay if spec does not mention it, as OTel C++/Rust can offer this as extras.
Originally posted by @cijothomas in #4203 (comment)
- Having event name as a field would make adding some events processing functionalities to the Logs SDK easier (e.g. filtering based on event name)
 
I am against this proposal as I do not think that handling
event.nameforEnabledis more important than for other attributes. Passing all attributes "destroys" the idea ofEnabledwhich is supposed to be used by the user to check whether it makes sense to build and emit a log records (performance tuning). The parameters accepted byLogger.Enabledshould be "cheap" to construct.The SDK's Enabled implementation would get the context, severity level, instrumentation scope that should be enough.
Side note: I think that instrumentation libraries emitting events could add a
event.namespaceinstrumentation scope attribute instead of putting the namespace to eachevent.namevalue as a prefix. EDIT: I created #4239If "event.name" is an attribute, then I totally agree!
(Which is why OTel .NET, C++, Rust all decided to put EventName as a top-level field in LogRecord, and not inside Attributes)
Originally posted by @cijothomas in #4220 (comment)
- 
Bridges for logging libraries that do not have a concept of log record identifier would need to have some convention to map
event.nameattribute intoEventNamefield. This mapping could be configurable. Therefore, people who do not want to emit events using logging libraries may disable this mapping behavior. - 
Emitting events would need to be done by calling
Emit Eventon Logger (see Add EmitEvent to Logs API #4259) (unless optional parameter EventName is added to Logger.Emit). Log bridges would have to call Emit Event when they would want to produce events 
Remark
The main question is whether we want to promote the event.name attribute to a LogRecord EventName string field. The decision on the desired field's name and type can be tracked as a separate issue.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status