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

Removing binding direction from event name when emitting binding metric to logs. #8128

Merged
merged 3 commits into from
Feb 11, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,7 @@ internal object LogInvocationMetrics(FunctionMetadata metadata)
{
string eventName = _bindingMetricEventNames.GetOrAdd(binding, static (b) =>
{
return b.IsTrigger ?
kshyju marked this conversation as resolved.
Show resolved Hide resolved
string.Format(MetricEventNames.FunctionBindingTypeFormat, b.Type) :
string.Format(MetricEventNames.FunctionBindingTypeDirectionFormat, b.Type, b.Direction);
kshyju marked this conversation as resolved.
Show resolved Hide resolved
return string.Format(MetricEventNames.FunctionBindingTypeFormat, b.Type);
});
_metrics.LogEvent(eventName, metadata.Name);
}
Expand Down
1 change: 0 additions & 1 deletion src/WebJobs.Script/Diagnostics/MetricEventNames.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public static class MetricEventNames
// function level events
public const string FunctionInvokeLatency = "function.invoke.latency";
public const string FunctionBindingTypeFormat = "function.binding.{0}";
public const string FunctionBindingTypeDirectionFormat = "function.binding.{0}.{1}";
public const string FunctionCompileLatencyByLanguageFormat = "function.compile.{0}.latency";
public const string FunctionInvokeThrottled = "function.invoke.throttled";
public const string FunctionUserLog = "function.userlog";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,12 @@ public void LogInvocationMetrics_EmitsExpectedEvents()

Assert.Equal(5, _metrics.LoggedEvents.Count());
Assert.Contains("function.binding.httptrigger_testfunction", _metrics.LoggedEvents);
Assert.Contains("function.binding.blob.in_testfunction", _metrics.LoggedEvents);
Assert.Contains("function.binding.blob.out_testfunction", _metrics.LoggedEvents);
Assert.Contains("function.binding.table.in_testfunction", _metrics.LoggedEvents);
Assert.Contains("function.binding.table.in_testfunction", _metrics.LoggedEvents);
Assert.Equal(1, _metrics.LoggedEvents.Count(x => x == "function.binding.httptrigger_testfunction"));

// for non-trigger bindings, event name does not include direction.
// So log entries for input and output binding will have same event name.
Assert.Equal(2, _metrics.LoggedEvents.Count(x => x == "function.binding.blob_testfunction"));
Assert.Equal(2, _metrics.LoggedEvents.Count(x => x == "function.binding.table_testfunction"));

// log the events once more
invokeLatencyEvent = _functionInstanceLogger.LogInvocationMetrics(metadata);
Expand Down