-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Azure-Samples/attribution2
Co-author augmentation
- Loading branch information
Showing
6 changed files
with
268 additions
and
268 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
using custom_metrics_emitter; | ||
|
||
IHost host = Host.CreateDefaultBuilder(args) | ||
.ConfigureServices((hostContext, services) => | ||
{ | ||
IConfiguration configuration = hostContext.Configuration; | ||
|
||
if (!string.IsNullOrEmpty(configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"])) | ||
{ | ||
services.AddApplicationInsightsTelemetryWorkerService(); | ||
} | ||
services.AddHostedService<Worker>(); | ||
services.AddLogging(opt => | ||
{ | ||
opt.AddSimpleConsole(config => config.TimestampFormat = "[HH:mm:ss]"); | ||
}); | ||
|
||
}) | ||
.Build(); | ||
|
||
await host.RunAsync(); | ||
using custom_metrics_emitter; | ||
|
||
IHost host = Host.CreateDefaultBuilder(args) | ||
.ConfigureServices((hostContext, services) => | ||
{ | ||
IConfiguration configuration = hostContext.Configuration; | ||
|
||
if (!string.IsNullOrEmpty(configuration["APPLICATIONINSIGHTS_CONNECTION_STRING"])) | ||
{ | ||
services.AddApplicationInsightsTelemetryWorkerService(); | ||
} | ||
services.AddHostedService<Worker>(); | ||
services.AddLogging(opt => | ||
{ | ||
opt.AddSimpleConsole(config => config.TimestampFormat = "[HH:mm:ss]"); | ||
}); | ||
|
||
}) | ||
.Build(); | ||
|
||
await host.RunAsync(); | ||
|
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 |
---|---|---|
@@ -1,14 +1,14 @@ | ||
namespace custom_metrics_emitter; | ||
|
||
public record EmitterConfig( | ||
string Region, | ||
string SubscriptionId, | ||
string ResourceGroup, | ||
string TenantId, | ||
string EventHubNamespace, | ||
string EventHubName, | ||
string ConsumerGroup, | ||
string CheckpointAccountName, | ||
string CheckpointContainerName, | ||
int CustomMetricInterval, | ||
namespace custom_metrics_emitter; | ||
|
||
public record EmitterConfig( | ||
string Region, | ||
string SubscriptionId, | ||
string ResourceGroup, | ||
string TenantId, | ||
string EventHubNamespace, | ||
string EventHubName, | ||
string ConsumerGroup, | ||
string CheckpointAccountName, | ||
string CheckpointContainerName, | ||
int CustomMetricInterval, | ||
string ManagedIdentityClientId); |
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 |
---|---|---|
@@ -1,29 +1,29 @@ | ||
namespace custom_metrics_emitter.emitters; | ||
namespace custom_metrics_emitter.emitters; | ||
|
||
using System.Text.Json.Serialization; | ||
|
||
// https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/metrics-store-custom-rest-api | ||
|
||
#pragma warning disable IDE1006 // Naming Styles | ||
|
||
#pragma warning disable IDE1006 // Naming Styles | ||
|
||
public record EmitterSchema( | ||
DateTime time, | ||
CustomMetricData? data); | ||
|
||
public record CustomMetricData( | ||
CustomMetricBaseData? baseData); | ||
|
||
public record CustomMetricBaseData( | ||
string? metric, | ||
string? Namespace, | ||
IEnumerable<string>? dimNames, | ||
IEnumerable<CustomMetricBaseDataSeriesItem>? series); | ||
|
||
public record CustomMetricBaseDataSeriesItem( | ||
IEnumerable<string>? dimValues, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? min, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? max, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? sum, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? count); | ||
|
||
#pragma warning restore IDE1006 // Naming Styles | ||
|
||
public record CustomMetricBaseData( | ||
string? metric, | ||
string? Namespace, | ||
IEnumerable<string>? dimNames, | ||
IEnumerable<CustomMetricBaseDataSeriesItem>? series); | ||
|
||
public record CustomMetricBaseDataSeriesItem( | ||
IEnumerable<string>? dimValues, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? min, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? max, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? sum, | ||
[property: JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingNull)] long? count); | ||
|
||
#pragma warning restore IDE1006 // Naming Styles |
Oops, something went wrong.