Skip to content

Commit

Permalink
Fix cspell errors in Monitor SDKs (#37077)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottaddie authored Jun 16, 2023
1 parent 8aeb2d1 commit 5296d93
Show file tree
Hide file tree
Showing 12 changed files with 91 additions and 47 deletions.
56 changes: 50 additions & 6 deletions .vscode/cspell.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.1",
"version": "0.2",
"language": "en_US",
"languageId": "csharp",
"dictionaries": [
Expand Down Expand Up @@ -31,6 +31,7 @@
"*.sln",
"*.user",
".vscode/cspell.json",
"assets.json",
// These services are opted out of public API surface spell checking.
// Spelling issues must be addressed before adding these back in.
"sdk/agrifood/*/api/*.cs",
Expand All @@ -42,7 +43,8 @@
"sdk/insights/*/api/*.cs",
"sdk/machinelearningservices/*/api/*.cs",
"sdk/modelsrepository/*/api/*.cs",
"sdk/monitor/*/api/*.cs",
"sdk/monitor/Azure.ResourceManager.Monitor/api/*.cs",
"sdk/monitor/Microsoft.Azure.Management.Monitor/**/*.cs",
"sdk/objectanchors/*/api/*.cs",
"sdk/purview/*/api/*.cs",
"sdk/remoterendering/*/api/*.cs",
Expand All @@ -56,28 +58,35 @@
"apos",
"azsdk",
"blazor",
"centralus",
"contoso",
"cref",
"deduplication",
"deserializable",
"deserializes",
"diagnoser",
"dicom",
"distro",
"dont",
"dotnetcli",
"dtmf",
"eastus",
"epsg",
"expando",
"fhir",
"finalizer",
"finalizers",
"hnsw",
"ienumerable",
"illumos",
"interventional",
"ints",
"kubernetes",
"kusto",
"lucene",
"mgmt",
"msal",
"northcentralus",
"nunit",
"odata",
"onco",
Expand All @@ -95,6 +104,7 @@
"retriable",
"signup",
"skus",
"southcentralus",
"structs",
"uints",
"unbilled",
Expand All @@ -105,6 +115,7 @@
"vcpus",
"vmss",
"vnet",
"westcentralus",
"westus",
"xunit"
],
Expand Down Expand Up @@ -364,8 +375,7 @@
{
"filename": "**/sdk/datashare/**/*.cs",
"words": [
"adls",
"kusto"
"adls"
]
},
{
Expand Down Expand Up @@ -636,7 +646,6 @@
{
"filename": "**/sdk/kusto/**/*.cs",
"words": [
"kusto",
"tbps",
"scsv",
"sohsv",
Expand Down Expand Up @@ -670,6 +679,42 @@
"scms"
]
},
{
"filename": "**/sdk/monitor/**/*",
"words": [
"AMPM",
"bcdr",
"cikey",
"faas",
"gzipped",
"gzipping",
"DDYYYYHHMMSS",
"hmac",
"HMACSHA",
"ikey",
"itsm",
"jdbc",
"jioindiacentral",
"jioindiawest",
"kaby",
"khtml",
"Localizable",
"Milli",
"msdocs",
"mslinks",
"myvm",
"onboarded",
"opinsights",
"OTELRESOURCE",
"otlp",
"TMPDIR",
"uaecentral",
"uaenorth",
"uksouth",
"ukwest",
"webwk"
]
},
{
"filename": "**/sdk/mysql/**/*.cs",
"words": [
Expand Down Expand Up @@ -1001,7 +1046,6 @@
{
"filename": "**/sdk/synapse/**/*.cs",
"words": [
"kusto",
"nchar",
"ntext",
"nvarchar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class AzureMonitorOptions : ClientOptions

/// <summary>
/// Get or sets the value of <see cref="TokenCredential" />.
/// If <see cref="TokenCredential" /> is not set, AAD authenication is disabled
/// If <see cref="TokenCredential" /> is not set, AAD authentication is disabled
/// and Instrumentation Key from the Connection String will be used.
/// </summary>
/// <remarks>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public DistroWebAppLiveTests(bool isAsync) : base(isAsync) { }
[SyncOnly] // This test cannot run concurrently with another test because OTel instruments the process and will cause side effects.
public async Task VerifyDistro()
{
// SETUP TELEMETRY CLIENT (FOR QUERIYNG LOG ANALYTICS)
// SETUP TELEMETRY CLIENT (FOR QUERYING LOG ANALYTICS)
_logsQueryClient = InstrumentClient(new LogsQueryClient(
TestEnvironment.LogsEndpoint,
TestEnvironment.Credential,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ internal static void AddPropertiesToTelemetry(IDictionary<string, string> destin
internal static void AddActivityLinksToProperties(Activity activity, ref AzMonList UnMappedTags)
{
string msLinks = "_MS.links";
// max number of links that can fit in this json formatted string is 107. it is based on assumption that traceid and spanid will be of fixed length.
// max number of links that can fit in this json formatted string is 107. it is based on assumption that TraceId and SpanId will be of fixed length.
// Keeping max at 100 for now.
int maxLinks = MaxlinksAllowed;

Expand Down Expand Up @@ -173,26 +173,26 @@ internal static string GetOperationName(Activity activity, ref AzMonList MappedT

private static void AddTelemetryFromActivityEvents(Activity activity, TelemetryItem telemetryItem, List<TelemetryItem> telemetryItems)
{
foreach (ref readonly var evnt in activity.EnumerateEvents())
foreach (ref readonly var @event in activity.EnumerateEvents())
{
try
{
if (evnt.Name == SemanticConventions.AttributeExceptionEventName)
if (@event.Name == SemanticConventions.AttributeExceptionEventName)
{
var exceptionData = GetExceptionDataDetailsOnTelemetryItem(evnt);
var exceptionData = GetExceptionDataDetailsOnTelemetryItem(@event);
if (exceptionData != null)
{
var exceptionTelemetryItem = new TelemetryItem("Exception", telemetryItem, activity.SpanId, activity.Kind, evnt.Timestamp);
var exceptionTelemetryItem = new TelemetryItem("Exception", telemetryItem, activity.SpanId, activity.Kind, @event.Timestamp);
exceptionTelemetryItem.Data = exceptionData;
telemetryItems.Add(exceptionTelemetryItem);
}
}
else
{
var messageData = GetTraceTelemetryData(evnt);
var messageData = GetTraceTelemetryData(@event);
if (messageData != null)
{
var traceTelemetryItem = new TelemetryItem("Message", telemetryItem, activity.SpanId, activity.Kind, evnt.Timestamp);
var traceTelemetryItem = new TelemetryItem("Message", telemetryItem, activity.SpanId, activity.Kind, @event.Timestamp);
traceTelemetryItem.Data = messageData;
telemetryItems.Add(traceTelemetryItem);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ internal TransmitFromStorageHandler(ApplicationInsightsRestClient applicationIns

internal void TransmitFromStorage(object? sender, ElapsedEventArgs? e)
{
// Only proces 10 files at a time so that we don't end up taking lot of cpu
// Only process 10 files at a time so that we don't end up taking lot of cpu
// if the number of files are large.
int fileCount = 10;
while (fileCount > 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public ValueTask<ExportResult> TrackAsync(IEnumerable<TelemetryItem> telemetryIt
return new ValueTask<ExportResult>(Task.FromResult(ExportResult.Success));
}

public ValueTask TransmitFromStorage(long maxFileToTransmit, bool aysnc, CancellationToken cancellationToken)
public ValueTask TransmitFromStorage(long maxFileToTransmit, bool async, CancellationToken cancellationToken)
{
throw new System.NotImplementedException();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public void TestEndpointSuffix_WithLocation_WithExplicitOverride()
}

[Fact]
public void TestExpliticOverride_PreservesSchema()
public void TestExplicitOverride_PreservesSchema()
{
RunTest(
connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=http://custom.contoso.com:444/",
Expand All @@ -94,7 +94,7 @@ public void TestExpliticOverride_PreservesSchema()
}

[Fact]
public void TestExpliticOverride_InvalidValue()
public void TestExplicitOverride_InvalidValue()
{
Assert.Throws<InvalidOperationException>(() => RunTest(
connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https:////custom.contoso.com",
Expand All @@ -103,7 +103,7 @@ public void TestExpliticOverride_InvalidValue()
}

[Fact]
public void TestExpliticOverride_InvalidValue2()
public void TestExplicitOverride_InvalidValue2()
{
Assert.Throws<InvalidOperationException>(() => RunTest(
connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;IngestionEndpoint=https://www.~!@#$%&^*()_{}{}><?<?>:L\":\"_+_+_",
Expand All @@ -112,7 +112,7 @@ public void TestExpliticOverride_InvalidValue2()
}

[Fact]
public void TestExpliticOverride_InvalidValue3()
public void TestExplicitOverride_InvalidValue3()
{
Assert.Throws<InvalidOperationException>(() => RunTest(
connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=~!@#$%&^*()_{}{}><?<?>:L\":\"_+_+_",
Expand All @@ -121,7 +121,7 @@ public void TestExpliticOverride_InvalidValue3()
}

[Fact]
public void TestExpliticOverride_InvalidLocation()
public void TestExplicitOverride_InvalidLocation()
{
Assert.Throws<InvalidOperationException>(() => RunTest(
connectionString: "InstrumentationKey=00000000-0000-0000-0000-000000000000;EndpointSuffix=ingestion.azuremonitor.com;Location=~!@#$%&^*()_{}{}><?<?>:L\":\"_+_+_",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,18 @@ public void VerifyCounter(bool asView)
var meterName = $"meterName{uniqueTestId}";
using var meter = new Meter(meterName, "1.0");

var meterProviderBulider = Sdk.CreateMeterProviderBuilder()
var meterProviderBuilder = Sdk.CreateMeterProviderBuilder()
.AddMeter(meterName)
.AddAzureMonitorMetricExporterForTest(out List<TelemetryItem> telemetryItems);

if (asView)
{
meterProviderBulider
meterProviderBuilder
// Rename an instrument to new name.
.AddView(instrumentName: "MyCounter", name: "MyCounterRenamed");
}

var meterProvider = meterProviderBulider.Build();
var meterProvider = meterProviderBuilder.Build();

// ACT
var counter = meter.CreateCounter<long>("MyCounter");
Expand Down Expand Up @@ -85,18 +85,18 @@ public void VerifyHistogram(bool asView)
var meterName = $"meterName{uniqueTestId}";
using var meter = new Meter(meterName, "1.0");

var meterProviderBulider = Sdk.CreateMeterProviderBuilder()
var meterProviderBuilder = Sdk.CreateMeterProviderBuilder()
.AddMeter(meterName)
.AddAzureMonitorMetricExporterForTest(out List<TelemetryItem> telemetryItems);

if (asView)
{
meterProviderBulider
meterProviderBuilder
// Change Histogram boundaries
.AddView(instrumentName: "MyHistogram", name: "MyHistogramRenamed");
}

var meterProvider = meterProviderBulider.Build();
var meterProvider = meterProviderBuilder.Build();

// ACT
var histogram = meter.CreateHistogram<long>("MyHistogram");
Expand Down Expand Up @@ -133,28 +133,28 @@ public void VerifyHistogram(bool asView)
[Theory]
[InlineData(true)]
[InlineData(false)]
public void VerifyGuage(bool asView)
public void VerifyGauge(bool asView)
{
// SETUP
var uniqueTestId = Guid.NewGuid();

var meterName = $"meterName{uniqueTestId}";
using var meter = new Meter(meterName, "1.0");

var meterProviderBulider = Sdk.CreateMeterProviderBuilder()
var meterProviderBuilder = Sdk.CreateMeterProviderBuilder()
.AddMeter(meterName)
.AddAzureMonitorMetricExporterForTest(out List<TelemetryItem> telemetryItems);

if (asView)
{
meterProviderBulider
.AddView(instrumentName: "MyGuage", name: "MyGuageRenamed");
meterProviderBuilder
.AddView(instrumentName: "MyGauge", name: "MyGaugeRenamed");
}

var meterProvider = meterProviderBulider?.Build();
var meterProvider = meterProviderBuilder?.Build();

// ACT
var myObservableGauge = meter.CreateObservableGauge("MyGuage", () =>
var myObservableGauge = meter.CreateObservableGauge("MyGauge", () =>
new Measurement<double>(
value: 123.45,
tags: new KeyValuePair<string, object?>("tag1", "value1")));
Expand All @@ -169,7 +169,7 @@ public void VerifyGuage(bool asView)

TelemetryItemValidationHelper.AssertMetricTelemetry(
telemetryItem: telemetryItem,
expectedMetricDataPointName: asView ? "MyGuageRenamed" : "MyGuage",
expectedMetricDataPointName: asView ? "MyGaugeRenamed" : "MyGauge",
expectedMetricDataPointValue: 123.45,
expectedMetricsProperties: new Dictionary<string, string> { { "tag1", "value1" } });
}
Expand All @@ -185,17 +185,17 @@ public void VerifyUpDownCounter(bool asView)
var meterName = $"meterName{uniqueTestId}";
using var meter = new Meter(meterName, "1.0");

var meterProviderBulider = Sdk.CreateMeterProviderBuilder()
var meterProviderBuilder = Sdk.CreateMeterProviderBuilder()
.AddMeter(meterName)
.AddAzureMonitorMetricExporterForTest(out List<TelemetryItem> telemetryItems);

if (asView)
{
meterProviderBulider
meterProviderBuilder
.AddView(instrumentName: "MyUpDownCounter", name: "MyUpDownCounterRenamed");
}

var meterProvider = meterProviderBulider.Build();
var meterProvider = meterProviderBuilder.Build();

// ACT
var upDownCounter = meter.CreateUpDownCounter<long>("MyUpDownCounter");
Expand Down Expand Up @@ -231,17 +231,17 @@ public void VerifyObservableUpDownCounter(bool asView)
var meterName = $"meterName{uniqueTestId}";
using var meter = new Meter(meterName, "1.0");

var meterProviderBulider = Sdk.CreateMeterProviderBuilder()
var meterProviderBuilder = Sdk.CreateMeterProviderBuilder()
.AddMeter(meterName)
.AddAzureMonitorMetricExporterForTest(out List<TelemetryItem> telemetryItems, out MetricReader metricReader);

if (asView)
{
meterProviderBulider
meterProviderBuilder
.AddView(instrumentName: "MyUpDownCounter", name: "MyUpDownCounterRenamed");
}

using var meterProvider = meterProviderBulider.Build();
using var meterProvider = meterProviderBuilder.Build();

// ACT
var value = 1;
Expand Down
Loading

0 comments on commit 5296d93

Please sign in to comment.