Skip to content

Commit

Permalink
add no-pop Baggage to Datadog.Trace.Manual
Browse files Browse the repository at this point in the history
  • Loading branch information
lucaspimentel committed Oct 23, 2024
1 parent 4e13e08 commit ad32a8f
Showing 1 changed file with 88 additions and 0 deletions.
88 changes: 88 additions & 0 deletions tracer/src/Datadog.Trace.Manual/Baggage.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
// <copyright file="Baggage.cs" company="Datadog">
// Unless explicitly stated otherwise all files in this repository are licensed under the Apache 2 License.
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2017 Datadog, Inc.
// </copyright>

using Datadog.Trace.SourceGenerators;

namespace Datadog.Trace;

/// <summary>
/// Baggage is a collection of name-value pairs that are propagated to downstream services.
/// </summary>
public class Baggage
{
private static readonly Baggage _current = new();

/// <summary>
/// Initializes a new instance of the <see cref="Baggage"/> class.
/// </summary>
public Baggage()
{
}

/// <summary>
/// Gets the baggage collection for the current execution context.
/// </summary>
[Instrumented]
public static Baggage Current
{
get => _current;
}

/// <summary>
/// Gets a value indicating whether this baggage collection is empty.
/// </summary>
[Instrumented]
public bool IsEmpty => true;

/// <summary>
/// Gets the baggage value associated with the specified name.
/// </summary>
/// <param name="name">The baggage item name.</param>
/// <returns>Returns the baggage item value, or <c>null</c> if not found.</returns>
[Instrumented]
public string? Get(string name)
{
return string.Empty;
}

/// <summary>
/// Gets all baggage values.
/// </summary>
/// <returns>All baggage values.</returns>
[Instrumented]
public KeyValuePair<string, string>[] GetAll()
{
return [];
}

/// <summary>
/// Sets the baggage value associated with the specified name.
/// </summary>
/// <param name="name">The baggage item name.</param>
/// <param name="value">The baggage item value.</param>
[Instrumented]
public void Set(string name, string? value)
{
}

/// <summary>
/// Removes the baggage value associated with the specified name.
/// </summary>
/// <param name="name">The baggage item name.</param>
/// <returns><c>true</c> if the object was removed successfully; otherwise, <c>false</c>.</returns>
[Instrumented]
public bool Remove(string name)
{
return false;
}

/// <summary>
/// Removes all baggage values.
/// </summary>
[Instrumented]
public void Clear()
{
}
}

0 comments on commit ad32a8f

Please sign in to comment.