Skip to content

Commit

Permalink
change Cosmos dependency type to PR namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
lmolkova committed Oct 19, 2022
1 parent ed20d75 commit 3a42fc7
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1300,7 +1300,7 @@ public void AzureCosmosDbSpansAreCollected()
Assert.AreEqual("container | ReadItems", dependency.Name);
Assert.AreEqual("my.documents.azure.com | database", dependency.Target);
Assert.AreEqual("503", dependency.ResultCode);
Assert.AreEqual("Azure CosmosDB", dependency.Type);
Assert.AreEqual("Microsoft.DocumentDB", dependency.Type);
Assert.IsTrue(String.IsNullOrEmpty(dependency.Data));

Assert.IsTrue(dependency.Properties.ContainsKey("db.name"));
Expand Down Expand Up @@ -1348,7 +1348,7 @@ public void AzureCosmosDbSpansErrorsAreCollected()
Assert.AreEqual("container | ReadItems", dependency.Name);
Assert.AreEqual("my.documents.azure.com | database", dependency.Target);
Assert.AreEqual("200", dependency.ResultCode);
Assert.AreEqual("Azure CosmosDB", dependency.Type);
Assert.AreEqual("Microsoft.DocumentDB", dependency.Type);
}
}

Expand Down Expand Up @@ -1383,7 +1383,7 @@ public void AzureCosmosDbSpansAreCollectedWithExtraAttributes()
Assert.AreEqual("container | ReadItems", dependency.Name);
Assert.AreEqual("my.documents.azure.com | database", dependency.Target);
Assert.AreEqual("503", dependency.ResultCode);
Assert.AreEqual("Azure CosmosDB", dependency.Type);
Assert.AreEqual("Microsoft.DocumentDB", dependency.Type);
Assert.AreEqual("2", dependency.Properties["db.cosmosdb.retry_count"]);
Assert.AreEqual("0.123", dependency.Properties["db.cosmosdb.request_charge"]);
Assert.AreEqual("Direct", dependency.Properties["db.cosmosdb.connection_mode"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

internal class AzureSdkDiagnosticsEventHandler : DiagnosticsEventHandlerBase
{
private const string CosmosDBResourceProviderNs = "Microsoft.DocumentDB";
#if NET452
private static readonly DateTimeOffset EpochStart = new DateTime(1970, 1, 1, 0, 0, 0, 0, System.DateTimeKind.Utc);
#endif
Expand Down Expand Up @@ -100,7 +101,7 @@ public override void OnEvent(KeyValuePair<string, object> evnt, DiagnosticListen
dependency.SetOperationDetail(evnt.Value.GetType().FullName, evnt.Value);
}
}
else if (dependency.Type.EndsWith(RemoteDependencyConstants.AzureCosmosDb, StringComparison.Ordinal))
else if (dependency.Type == CosmosDBResourceProviderNs)
{
SetCosmosDbProperties(currentActivity, dependency);
}
Expand Down Expand Up @@ -254,10 +255,6 @@ private static string GetType(Activity currentActivity)
{
component = RemoteDependencyConstants.AzureServiceBus;
}
else if (component == "Microsoft.DocumentDB")
{
component = RemoteDependencyConstants.AzureCosmosDb;
}

if (component != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ internal static class RemoteDependencyConstants
public const string AzureTable = "Azure table";
public const string AzureQueue = "Azure queue";
public const string AzureDocumentDb = "Azure DocumentDB";
public const string AzureCosmosDb = "Azure CosmosDB";
public const string AzureEventHubs = "Azure Event Hubs";
public const string AzureServiceBus = "Azure Service Bus";
public const string AzureIotHub = "Azure IoT Hub";
Expand Down

0 comments on commit 3a42fc7

Please sign in to comment.