-
Notifications
You must be signed in to change notification settings - Fork 175
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
[logs] Add semantic conventions for durable identifiers #372
Comments
While I "like" the idea of an The And looking at a Log definition isn't there already a In my opinion what you are trying to do "should" really be it's own event so something like
With the
|
Thats does not look durable... |
|
Is this durable id essentially just a numeric representation of |
Note: for "events" we do have an open issue on whether to "keep" both the So it may become something like So any input / preference you might have for identifying that uniqueness of an event would be welcome. |
@jack-berg In .NET durable id is traditionally a manually-assigned thing. Eg:
There is a category name in .NET but it isn't part of the There is a new thing coming in .NET 8 (Nov 2023) to auto-generate I like the structure you are proposing for turning these into "events" but that is a probably a non-starter. For a couple of reasons:
|
I just gave the domain "dotnet" as an example, if this can be rationalized into something more generic then it would work.
No, I would expect the reverse as every "client" (browser, android app, ios app, etc) could be sending thousands of (defined) events. eg. some websites track user clicks. And as part of "decoding" these values they have specific UI to handle these events.
But MS does this today, it doesn't necessarily need to happen at the first receiver but and there are cases of some sub-teams performing this at the point of querying the data -- but it DOES happen and is required for defining health alerts in relation to "some" events (such as client side JavaScript errors) |
This is actually one of the main sub-points for why we are pushing for defining the "shape" of an event, (domain, name, payload (event.data)) is so that venders / clients / receivers can make the decision on whether they event want to "parse" the payload (based on the "name") to perform either
|
Ya I don't know about the volume bit. I think a human doing things will always be much less than a cloud cranking out logs at scale. But let's put that aside for a second. Why do we want these logs to be some other signal? No one in the .NET community has asked for events (so far). What they are asking for are these attributes on their logs. What is the argument against... General Logs Attributes
|
log.record.uid already exists.
Not sure what you mean by this. Currently, OpenTelemetry logs and events share the same data model. As of now, event is defined as:
Where |
I think this would be a perfectly suitable solution:
But it is the "as of now" bit that is the problem for me. If the future goal is...
That seems like a non-starter. Because... a) We can't have a .NET specific solution. It most suit C++, Rust, and others. Let's say the user has a client application which calls out to a cloud service. Client app emits these RUM events and they show up in a nice event UI. The cloud app emits logs. Because of this bifurcation some logs go to a nice log UI and some logs go to the event UI and show mixed in with the client interactions. Good or bad experience? |
Let's ignore the event payload / Wondering if you can help me understand how I would use Now let's consider a future where we also add a How do we describe to a user what value should be used for
IMO, the point of the Event semantic conventions isn't to be prescriptive to how backends should process / ingest these Events. Its to give backends and users alike a very clean way to identify all the times a particular class / type of thing happened. With spans we rely on duck typing: How do you identify a HTTP server span? You find all spans with If a backend wants to do something fancy, and store a particular type of event in a special way, that's fine, but it should also be fine for the backend to just treat all the log records the same, whether or not they have |
This may be the wrong thinking. What I'm pushing here is for the spec to define where appenders/bridge components can drop this information should the originating framework support such a concept. .NET ILogger usage is like this: public class WeatherForecastController
{
private readonly ILogger<WeatherForecastController> _logger;
public WeatherForecastController(ILogger<WeatherForecastController> logger)
{
_logger = logger;
}
public IEnumerable<WeatherForecast> Get()
{
WeatherForecast[] forecasts = GenerateForecasts();
_logger.LogInformation(
eventId: LogEvents.WeatherForecastsGenerated,
message: "WeatherForecasts generated {count}",
args: forecasts.Length);
return forecasts;
}
}
internal static class LogEvents
{
public static EventId WeatherForecastsGenerated { get; } = new(id: 4001);
} Let's look at some different ways we could send this off. [Parden the pseudo json here. Trying to sort of show how it would look for OTLP log data model but I didn't try to nail the structure perfectly.] One thing we are looking at for the
Or using
EventSource (C++, .NET) usage is like this: [EventSource(Name = "MyLibrary")]
internal class LibraryEventSource : EventSource
{
public static LibraryEventSource Log = new();
[Event(100_001, Message = "Unexpected request length: {0}", Level = EventLevel.Warning)]
public void LogUnexpectedRequestLengthWarning(int requestLength)
{
WriteEvent(100_001, requestLength);
}
}
public class SomeClass
{
public bool ProcessRequest(int length)
{
if (length < 0 || length > 1024)
{
LibraryEventSource.Log.LogUnexpectedRequestLengthWarning(length);
return false;
}
// Process request
return true;
}
} Here is how that might look using the same styles:
Or using
We shouldn't. Again, I'm not trying to design a new event API. I'm trying to bridge things. It is up to the logging framework to define that. We just need to give it a home. |
Exactly
Spot on, the domain/name combination is the "key" value that backends would use to determine (if) they want to do anything special. Ahh, now that I see all 3 examples (it takes be back to my C++ .COM days) I see that the One of the things we have not yet get to defining as part of the event definition is "how would any application represent their own 'Custom' event" and I think this specific case is really about how do you take the So apart from just defining this as a normal
|
Should we meet on this? It feels like everything is pulling in different directions. Here is an idea... In the data model spec, InstrumentationScope for logs has an interesting quirk where the Logger Name SHOULD be recorded as the Instrumenation Scope name. What we're doing in .NET at the moment is putting our Let's say we do that and drop We have an area in the spec called So we delete the events semantic conventions and define...
[1]: A durable numerical identifier that can be used to differentiate logs from each other. If a durable id is provided, other log records of the same shape should use the same id. Durable identifiers SHOULD be unique for a given instrumentation scope. A hash of the instrumentation scope name and log template may be used to create a durable identifier. Essentially what I'm saying is instrumentation scope name gives us the "domain" or "namespace" we were using |
I agree. Based on my understanding of your requirements, here's my suggestion for this issue. Delete "Proposal B" from the issue description because I think it has distracted the conversation away from your needs. OpenTelemetry is defining a concept of events, but your requirements seem unrelated. The concept you're proposing of a durable identifier seems different. It sounds like you need a way to classify logs, but not necessarily strictly define the log's schema/shape. My understanding of OpenTelemetry events is that a particular kind of event has a strictly defined schema, so it is the wrong tool for your needs.
If I'm correct that your requirements are unrelated to OpenTelemetry events, I do not think it makes sense to recommend any alterations to the event conventions. I think in this way you can refocus the effort solely on the the introduction of a |
@CodeBlanch was there ever any conclusion for this topic? The temporary |
@cjablonski76 From what I can tell, no progress and this topic is still open. |
I think this got too confused with events. I'm going to recreate as something more specific to logs. |
In my opinion the As an alternative I would live with @CodeBlanch: Have you already created a new issue for this? |
I want to give a different perspective. The elastic common schema (ECS) is a standard which is comming from elastic. What I have understood is that on long term the ECS fields will be integrated somehow into the otel standard (which makes sense). That doesn't mean that otel can import concepts from the ECS standard as well. If you take a look into the Event Fields you will find:
This is exactly we are talking about. Is it only .NET Framework related!? No, it is not. |
@HHobeck That is my understanding as well based on #1339 (comment) (You are right! It is not .NET related. .NET was merely used to show an example as its (whether we use "event.id" or "event.code" for the machine-friendly version - No strong preference for me either way. It surely looks like event.code from ECS was intended to be the same idea. |
This issue was closed but I don't see a link to the new issue. Where is it? |
#1339 |
That PR is closed. A new, new issue is needed. Or reopen this one. The reason why I'm interested: I have a UI for viewing semantic logs. Filtering by log name/id seems like a first class concept and it would be good to have known attribute names that could be used to filter the applicable attribute. |
Yes agree. These are open questions:
|
We have a need across Microsoft to support durable identifiers in logging. A durable identifier could be just an "id" or it could be an "id" + "name". This should be uniform across languages (C++, .NET, Rust, etc.) so that backends can be coded with rules to act on specific log messages.
Definitions
id
:A durable numerical identifier, that can be used to differentiate logs from each other. This is not guaranteed to be unique in anyway. This could be used for scenarios such as filtering based on identifier, triggering actions (for example, when a log with a given eventId is fired, take a memory dump) etc.
name
:Short event identifier that does not contain varying parts. Name describes what happened (e.g. "ProcessStarted"). Recommended to be no longer than 50 characters. Not guaranteed to be unique in any way. Typically used for filtering and grouping purposes in backends.
Proposal
I am going to propose 2 ways to go about this:
Proposal A
Add new fields on
General log identification attributes
: https://github.com/open-telemetry/semantic-conventions/compare/main...CodeBlanch:logs-id-and-name?expand=1I think this is a nice fit.
Proposal B
Loosen the events semantic conventions for
event.domain
&event.name
and addevent.id
: https://github.com/open-telemetry/semantic-conventions/compare/main...CodeBlanch:events-id?expand=1I don't think this is a particularly nice fit as these are logs and not "events" as the working group originally intended, however it seems some languages have gone down this road:
Logrecord.EventId
opentelemetry-dotnet#4925/cc @alanwest @reyang @trask @utpilla @vishweshbankwar @rajkumar-rangaraj @cijothomas @jack-berg @ThomsonTan @MSNev
The text was updated successfully, but these errors were encountered: