-
Notifications
You must be signed in to change notification settings - Fork 459
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Metrics and support bundle 110 (#3372)
- Loading branch information
Showing
71 changed files
with
4,696 additions
and
1,088 deletions.
There are no files selected for viewing
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
13 changes: 0 additions & 13 deletions
13
edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/logs/ILogsUploader.cs
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/logs/IRequestsUploader.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,16 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
namespace Microsoft.Azure.Devices.Edge.Agent.Core.Logs | ||
{ | ||
using System; | ||
using System.IO; | ||
using System.Threading.Tasks; | ||
|
||
public interface IRequestsUploader | ||
{ | ||
Task UploadLogs(string uri, string module, byte[] payload, LogsContentEncoding logsContentEncoding, LogsContentType logsContentType); | ||
|
||
Task<Func<ArraySegment<byte>, Task>> GetLogsUploaderCallback(string uri, string module, LogsContentEncoding logsContentEncoding, LogsContentType logsContentType); | ||
|
||
Task UploadSupportBundle(string uri, Stream source); | ||
} | ||
} |
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
39 changes: 39 additions & 0 deletions
39
edge-agent/src/Microsoft.Azure.Devices.Edge.Agent.Core/metrics/MetadataMetrics.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,39 @@ | ||
// Copyright (c) Microsoft. All rights reserved. | ||
|
||
namespace Microsoft.Azure.Devices.Edge.Agent.Core.Metrics | ||
{ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using Microsoft.Azure.Devices.Edge.Util; | ||
using Microsoft.Azure.Devices.Edge.Util.Metrics; | ||
using Microsoft.Extensions.Logging; | ||
|
||
public class MetadataMetrics | ||
{ | ||
readonly IMetricsGauge metaData; | ||
readonly Func<Task<SystemInfo>> getSystemMetadata; | ||
|
||
public MetadataMetrics(IMetricsProvider metricsProvider, Func<Task<SystemInfo>> getSystemMetadata) | ||
{ | ||
this.getSystemMetadata = Preconditions.CheckNotNull(getSystemMetadata, nameof(getSystemMetadata)); | ||
|
||
Preconditions.CheckNotNull(metricsProvider, nameof(metricsProvider)); | ||
this.metaData = metricsProvider.CreateGauge( | ||
"metadata", | ||
"General metadata about the device. The value is always 0, information is encoded in the tags.", | ||
new List<string> { "edge_agent_version", "experimental_features", "host_information", MetricsConstants.MsTelemetry }); | ||
} | ||
|
||
public async Task Start(ILogger logger, string agentVersion, string experimentalFeatures) | ||
{ | ||
logger.LogInformation("Collecting metadata metrics"); | ||
string edgeletVersion = Newtonsoft.Json.JsonConvert.SerializeObject(await this.getSystemMetadata()); | ||
|
||
string[] values = { agentVersion, experimentalFeatures, edgeletVersion, true.ToString() }; | ||
this.metaData.Set(0, values); | ||
logger.LogInformation($"Set metadata metrics: {values.Join(", ")}"); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.