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

[shared] Remove TagTransformer and improve TagWriter #5602

Merged
Show file tree
Hide file tree
Changes from 1 commit
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: 0 additions & 2 deletions OpenTelemetry.sln
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Shared", "Shared", "{A49299
src\Shared\SemanticConventions.cs = src\Shared\SemanticConventions.cs
src\Shared\SpanAttributeConstants.cs = src\Shared\SpanAttributeConstants.cs
src\Shared\StatusHelper.cs = src\Shared\StatusHelper.cs
src\Shared\TagTransformer.cs = src\Shared\TagTransformer.cs
src\Shared\TagTransformerJsonHelper.cs = src\Shared\TagTransformerJsonHelper.cs
src\Shared\ThreadSafeRandom.cs = src\Shared\ThreadSafeRandom.cs
EndProjectSection
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ protected override void WriteBooleanTag(ref ConsoleTag consoleTag, string key, b
consoleTag.Value = value ? "true" : "false";
}

protected override void WriteStringTag(ref ConsoleTag consoleTag, string key, string value)
protected override void WriteStringTag(ref ConsoleTag consoleTag, string key, ReadOnlySpan<char> value)
{
consoleTag.Key = key;
consoleTag.Value = value;
consoleTag.Value = value.ToString();
}

protected override void WriteArrayTag(ref ConsoleTag consoleTag, string key, ArraySegment<byte> arrayUtf8JsonBytes)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ protected override void WriteBooleanTag(ref RepeatedField<OtlpCommon.KeyValue> t
tags.Add(new OtlpCommon.KeyValue { Key = key, Value = ToAnyValue(value) });
}

protected override void WriteStringTag(ref RepeatedField<OtlpCommon.KeyValue> tags, string key, string value)
protected override void WriteStringTag(ref RepeatedField<OtlpCommon.KeyValue> tags, string key, ReadOnlySpan<char> value)
{
tags.Add(new OtlpCommon.KeyValue { Key = key, Value = ToAnyValue(value) });
tags.Add(new OtlpCommon.KeyValue { Key = key, Value = ToAnyValue(value.ToString()) });
}

protected override void WriteArrayTag(ref RepeatedField<OtlpCommon.KeyValue> tags, string key, ref OtlpCommon.ArrayValue value)
Expand Down Expand Up @@ -95,9 +95,9 @@ public override void WriteBooleanValue(ref OtlpCommon.ArrayValue array, bool val
array.Values.Add(ToAnyValue(value));
}

public override void WriteStringValue(ref OtlpCommon.ArrayValue array, string value)
public override void WriteStringValue(ref OtlpCommon.ArrayValue array, ReadOnlySpan<char> value)
{
array.Values.Add(ToAnyValue(value));
array.Values.Add(ToAnyValue(value.ToString()));
}

public override void EndWriteArray(ref OtlpCommon.ArrayValue array)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected override void WriteFloatingPointTag(ref Utf8JsonWriter writer, string
protected override void WriteBooleanTag(ref Utf8JsonWriter writer, string key, bool value)
=> writer.WriteString(key, value ? "true" : "false");

protected override void WriteStringTag(ref Utf8JsonWriter writer, string key, string value)
protected override void WriteStringTag(ref Utf8JsonWriter writer, string key, ReadOnlySpan<char> value)
=> writer.WriteString(key, value);

protected override void WriteArrayTag(ref Utf8JsonWriter writer, string key, ArraySegment<byte> arrayUtf8JsonBytes)
Expand Down
208 changes: 0 additions & 208 deletions src/Shared/TagTransformer.cs

This file was deleted.

53 changes: 0 additions & 53 deletions src/Shared/TagTransformerJsonHelper.cs

This file was deleted.

2 changes: 1 addition & 1 deletion src/Shared/TagWriter/ArrayTagWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ internal abstract class ArrayTagWriter<TArrayState>

public abstract void WriteBooleanValue(ref TArrayState state, bool value);

public abstract void WriteStringValue(ref TArrayState state, string value);
public abstract void WriteStringValue(ref TArrayState state, ReadOnlySpan<char> value);

public abstract void EndWriteArray(ref TArrayState state);
}
2 changes: 1 addition & 1 deletion src/Shared/TagWriter/JsonStringArrayTagWriter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public override void WriteNullValue(ref JsonArrayTagWriterState state)
state.Writer.WriteNullValue();
}

public override void WriteStringValue(ref JsonArrayTagWriterState state, string value)
public override void WriteStringValue(ref JsonArrayTagWriterState state, ReadOnlySpan<char> value)
{
state.Writer.WriteStringValue(value);
}
Expand Down
Loading
Loading