-
Notifications
You must be signed in to change notification settings - Fork 450
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
175 additions
and
1 deletion.
There are no files selected for viewing
31 changes: 31 additions & 0 deletions
31
src/WebJobs.Script.WebHost/Diagnostics/WebHostMetricsLogger.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
using Microsoft.Azure.WebJobs.Script.Diagnostics; | ||
|
||
namespace WebJobs.Script.WebHost.Diagnostics | ||
{ | ||
public class WebHostMetricsLogger : IMetricsLogger | ||
{ | ||
public void BeginEvent(MetricEvent metricEvent) | ||
{ | ||
// TODO | ||
FunctionStartedEvent startedEvent = metricEvent as FunctionStartedEvent; | ||
if (startedEvent != null) | ||
{ | ||
startedEvent.StartTime = DateTime.Now; | ||
} | ||
} | ||
|
||
public void EndEvent(MetricEvent metricEvent) | ||
{ | ||
// TODO | ||
FunctionStartedEvent startedEvent = metricEvent as FunctionStartedEvent; | ||
if (startedEvent != null) | ||
{ | ||
startedEvent.EndTime = DateTime.Now; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using Microsoft.Azure.WebJobs.Script.Description; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Diagnostics | ||
{ | ||
public class FunctionStartedEvent : MetricEvent | ||
{ | ||
public FunctionStartedEvent(FunctionMetadata functionMetadata) | ||
{ | ||
FunctionMetadata = functionMetadata; | ||
Success = true; | ||
} | ||
|
||
public FunctionMetadata FunctionMetadata { get; private set; } | ||
|
||
public bool Success { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Diagnostics | ||
{ | ||
/// <summary> | ||
/// Defines an interface for emitting metric events from the | ||
/// script runtime for later aggregation and reporting. | ||
/// </summary> | ||
public interface IMetricsLogger | ||
{ | ||
/// <summary> | ||
/// Begins an event. | ||
/// </summary> | ||
/// <param name="metricEvent">The event.</param> | ||
void BeginEvent(MetricEvent metricEvent); | ||
|
||
/// <summary> | ||
/// Completes a previously started event. | ||
/// </summary> | ||
/// <param name="metricEvent">A previously started event.</param> | ||
void EndEvent(MetricEvent metricEvent); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
using System; | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Diagnostics | ||
{ | ||
public abstract class MetricEvent | ||
{ | ||
public DateTime StartTime { get; set; } | ||
|
||
public DateTime EndTime { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Copyright (c) .NET Foundation. All rights reserved. | ||
// Licensed under the MIT License. See License.txt in the project root for license information. | ||
|
||
namespace Microsoft.Azure.WebJobs.Script.Diagnostics | ||
{ | ||
/// <summary> | ||
/// Default implementation of <see cref="IMetricsLogger"/> that doesn't do any logging. | ||
/// </summary> | ||
public class MetricsLogger : IMetricsLogger | ||
{ | ||
public void BeginEvent(MetricEvent metricEvent) | ||
{ | ||
} | ||
|
||
public void EndEvent(MetricEvent metricEvent) | ||
{ | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters