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

Rename _metadata to metadata for elastic purposes #138

Merged
merged 3 commits into from
May 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/aspnetcore-with-serilog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ On run, the console will show various events written in ECS format, an example g
"@timestamp": "2020-03-13T14:17:18.4976763+11:00",
"log.level": "Information",
"message": "Request finished in 353.60360000000003ms 200 application/json; charset=utf-8",
"_metadata": {
"metadata": {
"message_template": "{HostingRequestFinishedLog:l}",
"elapsed_milliseconds": 353.60360000000003,
"status_code": 200,
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.CommonSchema.NLog/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ An example of the output is given below:
"@timestamp":"2020-02-20T16:07:06.7109766+11:00",
"log.level":"Info",
"message":"Info \"X\" 2.2",
"_metadata":{
"metadata":{
"value_x":"X",
"some_y":2.2
},
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.CommonSchema/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ The C# `Base` type includes a property called `Metadata` with the signature:
/// <summary>
/// Container for additional metadata against this event.
/// </summary>
[DataMember(Name = "_metadata")]
[DataMember(Name = "metadata")]
public IDictionary<string, object> Metadata { get; set; }
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ ref string loglevel
"@timestamp" => ReadDateTime(ref reader, ref @timestamp),
"log.level" => ReadString(ref reader, ref loglevel),
"message" => ReadProp<string>(ref reader, "message", ecsEvent, (b, v) => b.Message = v),
"_metadata" => ReadProp<IDictionary<string, object>>(ref reader, "_metadata", ecsEvent, (b, v) => b.Metadata = v),
"metadata" => ReadProp<IDictionary<string, object>>(ref reader, "metadata", ecsEvent, (b, v) => b.Metadata = v),
"tags" => ReadProp<string[]>(ref reader, "tags", ecsEvent, (b, v) => b.Tags = v),
"labels" => ReadProp<IDictionary<string, object>>(ref reader, "labels", ecsEvent, (b, v) => b.Labels = v),
"trace" => ReadProp<Trace>(ref reader, "trace", ecsEvent, (b, v) => b.Trace = v),
Expand Down Expand Up @@ -98,7 +98,7 @@ public override void Write(Utf8JsonWriter writer, TBase value, JsonSerializerOpt
WriteTimestamp(writer, value);
WriteLogLevel(writer, value);
WriteMessage(writer, value);
WriteProp(writer, "_metadata", value.Metadata);
WriteProp(writer, "metadata", value.Metadata);
WriteProp(writer, "tags", value.Tags);
WriteProp(writer, "labels", value.Labels);
// Complex types
Expand Down
2 changes: 1 addition & 1 deletion src/Elastic.CommonSchema/Types.Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public partial class Base
/// <summary>
/// Container for additional metadata against this event.
/// </summary>
[DataMember(Name = "_metadata")]
[DataMember(Name = "metadata")]
public IDictionary<string, object> Metadata { get; set; }

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Schema/YamlSpecification.cs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public IEnumerable<Tuple<string, Field>> BaseFieldsOrdered
// HACK in the log.level
Tuple.Create("WriteLogLevel", new Field { Name = LogLevelFieldName, Schema = baseRootObject, FlatName = LogLevelFieldName }),
Tuple.Create("WriteMessage", baseRootObject.Fields.Single(f => f.Key == MessageFieldName).Value),
Tuple.Create("WriteProp", new Field { Name = "_metadata", Schema = baseRootObject, FlatName = "_metadata" })
Tuple.Create("WriteProp", new Field { Name = "metadata", Schema = baseRootObject, FlatName = "metadata" })
};

list.AddRange(baseRootObject.GetFieldsFlat()
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/SchemaExtensionMethods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static string ClrType(this Field value)
if (value.FlatName == "labels") return "IDictionary<string, object>";

// C# custom property
if (value.Name == "_metadata") return "IDictionary<string, object>";
if (value.Name == "metadata") return "IDictionary<string, object>";

var tipe = "";
switch (value.Type)
Expand Down
2 changes: 1 addition & 1 deletion src/Generator/Views/Types.Generated.cshtml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ namespace Elastic.CommonSchema
/// <summary>
/// Container for additional metadata against this event.
/// </summary>
[DataMember(Name = "_metadata")]
[DataMember(Name = "metadata")]
public @Raw("IDictionary<string, object>") Metadata { get; set; }

@foreach (var schema in Model.NonBaseYamlSchemas())
Expand Down