Skip to content

Commit ef5866c

Browse files
committed
Added the old class to keep functionality for updates.
Signed-off-by: André Silva <[email protected]>
1 parent d14647d commit ef5866c

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
using OpenFeature.Model;
2+
using System.Threading.Tasks;
3+
using System.Collections.Generic;
4+
using System.Diagnostics.CodeAnalysis;
5+
using System;
6+
7+
namespace OpenFeature.Contrib.Hooks.Otel
8+
9+
{
10+
/// <summary>
11+
/// Stub.
12+
/// </summary>
13+
[ExcludeFromCodeCoverage]
14+
[Obsolete("This class is obsolete and will be removed in a future version. Please use TracingHook instead.")]
15+
public class OtelHook : Hook
16+
{
17+
private readonly TracingHook _tracingHook;
18+
19+
/// <summary>
20+
/// Stub.
21+
/// </summary>
22+
[Obsolete("This class is obsolete and will be removed in a future version. Please use TracingHook instead.")]
23+
public OtelHook()
24+
{
25+
_tracingHook = new TracingHook();
26+
}
27+
28+
/// <summary>
29+
/// After is executed after a feature flag has been evaluated.
30+
/// </summary>
31+
/// <param name="context">The hook context</param>
32+
/// <param name="details">The result of the feature flag evaluation</param>
33+
/// <param name="hints">Hints for the feature flag evaluation</param>
34+
/// <returns>An awaitable Task object</returns>
35+
public override Task After<T>(HookContext<T> context, FlagEvaluationDetails<T> details,
36+
IReadOnlyDictionary<string, object> hints = null)
37+
{
38+
_tracingHook.After(context, details, hints);
39+
40+
return Task.CompletedTask;
41+
}
42+
43+
/// <summary>
44+
/// Error is executed when an error during a feature flag evaluation occured.
45+
/// </summary>
46+
/// <param name="context">The hook context</param>
47+
/// <param name="error">The exception thrown by feature flag provider</param>
48+
/// <param name="hints">Hints for the feature flag evaluation</param>
49+
/// <returns>An awaitable Task object</returns>
50+
public override Task Error<T>(HookContext<T> context, System.Exception error,
51+
IReadOnlyDictionary<string, object> hints = null)
52+
{
53+
_tracingHook.Error(context, error, hints);
54+
55+
return Task.CompletedTask;
56+
}
57+
58+
}
59+
}
60+
61+

0 commit comments

Comments
 (0)