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

Minimize telemetry surface area #2844

Merged
merged 33 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
94a1f2c
first draft
davidmrdavid Jun 4, 2024
a56cf6d
remove unecessary diff
davidmrdavid Jun 10, 2024
ffdd81c
refactor
davidmrdavid Jun 10, 2024
17dceeb
refactor
davidmrdavid Jun 10, 2024
ba345d1
Refactor
davidmrdavid Jun 11, 2024
77ebaa6
refactor
davidmrdavid Jun 11, 2024
e1e865c
remove unecessary diff
davidmrdavid Jun 11, 2024
6bd3a33
add nullable checks
davidmrdavid Jun 11, 2024
95bcd87
add nullable checks in E2ETraceHelper
davidmrdavid Jun 11, 2024
dbd62d2
remove whitespace
davidmrdavid Jun 11, 2024
1ea40e3
add nullability checks
davidmrdavid Jun 11, 2024
a43292c
clean up
davidmrdavid Jun 11, 2024
e4fab7a
refactorings
davidmrdavid Jun 11, 2024
39f400e
refactorings
davidmrdavid Jun 11, 2024
80f6a09
add comments in csproj
davidmrdavid Jun 11, 2024
d3103fe
quick test
davidmrdavid Jun 13, 2024
1fe4e67
remove nullable assignment
davidmrdavid Jun 13, 2024
caf746e
small edit
davidmrdavid Jun 13, 2024
10ac5a9
minor refactor
davidmrdavid Jun 13, 2024
900b1a2
remove line
davidmrdavid Jun 13, 2024
032f566
remove line
davidmrdavid Jun 13, 2024
f31cad9
null string handling
davidmrdavid Jun 13, 2024
43f63fc
apply feedback
davidmrdavid Jun 17, 2024
f30f622
Merge branch 'dev' into dajusto/remove-potentially-sensitive-logs
davidmrdavid Jun 24, 2024
b1ec95d
remove replay controls
davidmrdavid Jul 3, 2024
de2e41c
Merge branch 'dajusto/remove-potentially-sensitive-logs' of https://g…
davidmrdavid Jul 3, 2024
73fed6e
add unit tests
davidmrdavid Jul 3, 2024
e16b912
Add unit tests
davidmrdavid Jul 3, 2024
8ed5d30
clean up tests
davidmrdavid Jul 3, 2024
5d15568
pass tests
davidmrdavid Jul 8, 2024
778cecd
increase timeout
davidmrdavid Jul 8, 2024
bac3b33
pass linter
davidmrdavid Jul 9, 2024
2af6b47
Merge branch 'dev' of https://github.com/Azure/azure-functions-durabl…
davidmrdavid Jul 9, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -122,13 +122,12 @@ bool IDurableEntityContext.HasState
public void CaptureInternalError(Exception e, TaskEntityShim shim)
{
// first, try to get a quick ETW message out to help us diagnose what happened
string details = Utils.IsFatal(e) ? e.GetType().Name : e.ToString();
this.Config.TraceHelper.EntityBatchFailed(
this.HubName,
this.Name,
this.InstanceId,
shim.TraceFlags,
details);
e);

// then, record the error for additional reporting and tracking in other places
this.InternalError = ExceptionDispatchInfo.Capture(e);
Expand Down Expand Up @@ -180,22 +179,27 @@ public void ThrowApplicationExceptionsIfAny()
}
}

public bool ErrorsPresent(out string description)
public bool ErrorsPresent(out string error, out string sanitizedError)
{
if (this.InternalError != null)
{
description = $"Internal error: {this.InternalError.SourceException}";
error = $"Internal error: {this.InternalError.SourceException}";
sanitizedError = $"Internal error: {this.InternalError.SourceException.GetType().FullName} \n {this.InternalError.SourceException.StackTrace}";
return true;
}
else if (this.ApplicationErrors != null)
{
var messages = this.ApplicationErrors.Select(i => $"({i.SourceException.Message})");
description = $"One or more operations failed: {string.Concat(messages)}";
error = $"One or more operations failed: {string.Concat(messages)}";

string errorTypes = string.Join(", ", this.ApplicationErrors.Select(i => i.SourceException.GetType().FullName));
sanitizedError = $"One or more operations failed: {errorTypes}";
return true;
}
else
{
description = string.Empty;
error = string.Empty;
sanitizedError = string.Empty;
return false;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -781,7 +781,7 @@ internal async Task<TResult> CallDurableTaskFunctionAsync<TResult>(
operationId,
operationName,
input: "(replayed)",
exception: "(replayed)",
exception: exception,
duration: 0,
isReplay: true);
}
Expand All @@ -791,7 +791,7 @@ internal async Task<TResult> CallDurableTaskFunctionAsync<TResult>(
this.Config.Options.HubName,
functionName,
this.InstanceId,
reason: $"(replayed {exception.GetType().Name})",
exception: exception,
functionType: functionType,
isReplay: true);
}
Expand Down Expand Up @@ -933,7 +933,7 @@ internal void RaiseEvent(string name, string input)
FunctionType.Orchestrator,
this.InstanceId,
name,
this.Config.GetIntputOutputTrace(responseMessage.Result),
responseMessage.Result,
this.IsReplaying);
}
else
Expand All @@ -943,7 +943,7 @@ internal void RaiseEvent(string name, string input)
this.Name,
this.InstanceId,
name,
this.Config.GetIntputOutputTrace(input),
input,
this.IsReplaying);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,11 @@ internal OrchestratorExecutionResult GetResult()
return this.executionResult ?? throw new InvalidOperationException($"The execution result has not yet been set using {nameof(this.SetResult)}.");
}

internal bool TryGetOrchestrationErrorDetails(out string details)
internal bool TryGetOrchestrationErrorDetails(out Exception? failure)
{
if (this.failure != null)
{
details = this.failure.Message;
return true;
}
else
{
details = string.Empty;
return false;
}
bool hasError = this.failure != null;
failure = hasError ? this.failure : null;
return hasError;
}

internal void SetResult(IEnumerable<OrchestratorAction> actions, string customStatus)
Expand Down
9 changes: 5 additions & 4 deletions src/WebJobs.Extensions.DurableTask/DurableTaskExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public DurableTaskExtension(

ILogger logger = loggerFactory.CreateLogger(LoggerCategoryName);

this.TraceHelper = new EndToEndTraceHelper(logger, this.Options.Tracing.TraceReplayEvents);
this.TraceHelper = new EndToEndTraceHelper(logger, this.Options.Tracing.TraceReplayEvents, this.Options.Tracing.TraceInputsAndOutputs);
this.LifeCycleNotificationHelper = lifeCycleNotificationHelper ?? this.CreateLifeCycleNotificationHelper();
this.durabilityProviderFactory = GetDurabilityProviderFactory(this.Options, logger, orchestrationServiceFactories);
this.defaultDurabilityProvider = this.durabilityProviderFactory.GetDurabilityProvider();
Expand Down Expand Up @@ -1037,7 +1037,7 @@ private async Task EntityMiddleware(DispatchMiddlewareContext dispatchContext, F
entityContext.HubName,
entityContext.Name,
entityContext.InstanceId,
this.GetIntputOutputTrace(runtimeState.Input),
runtimeState.Input,
FunctionType.Entity,
isReplay: false);

Expand All @@ -1063,13 +1063,14 @@ private async Task EntityMiddleware(DispatchMiddlewareContext dispatchContext, F
await next();

// 5. If there were internal or application errors, trace them for DF
if (entityContext.ErrorsPresent(out var description))
if (entityContext.ErrorsPresent(out string description, out string sanitizedError))
{
this.TraceHelper.FunctionFailed(
entityContext.HubName,
entityContext.Name,
entityContext.InstanceId,
description,
sanitizedReason: sanitizedError,
functionType: FunctionType.Entity,
isReplay: false);
}
Expand All @@ -1079,7 +1080,7 @@ private async Task EntityMiddleware(DispatchMiddlewareContext dispatchContext, F
entityContext.HubName,
entityContext.Name,
entityContext.InstanceId,
this.GetIntputOutputTrace(entityContext.State.EntityState),
entityContext.State.EntityState,
continuedAsNew: true,
functionType: FunctionType.Entity,
isReplay: false);
Expand Down
Loading
Loading