Skip to content

Commit

Permalink
changed event name
Browse files Browse the repository at this point in the history
  • Loading branch information
sourabh1007 committed Apr 29, 2024
1 parent 23b3f99 commit 1971185
Show file tree
Hide file tree
Showing 9 changed files with 188 additions and 206 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,21 +46,15 @@ public static void RecordDiagnosticsForRequests(
else if (DiagnosticsFilterHelper.IsLatencyThresholdCrossed(
config: config,
operationType: operationType,
response: response))
response: response) ||
(config.RequestChargeThreshold is not null &&
config.RequestChargeThreshold <= response.RequestCharge) ||
(config.PayloadSizeThresholdInBytes is not null &&
DiagnosticsFilterHelper.IsPayloadSizeThresholdCrossed(
config: config,
response: response)))
{
CosmosDbEventSource.Singleton.LatencyOverThreshold(response.Diagnostics.ToString());
}
else if (config.RequestChargeThreshold is not null &&
config.RequestChargeThreshold <= response.RequestCharge)
{
CosmosDbEventSource.Singleton.RequestChargeOverThreshold(response.Diagnostics.ToString());
}
else if (config.PayloadSizeThresholdInBytes is not null &&
DiagnosticsFilterHelper.IsPayloadSizeThresholdCrossed(
config: config,
response: response))
{
CosmosDbEventSource.Singleton.PayloadSizeOverThreshold(response.Diagnostics.ToString());
CosmosDbEventSource.Singleton.ThresholdViolation(response.Diagnostics.ToString());
}
}
}
Expand All @@ -81,7 +75,7 @@ private void Exception(string message)
}

[Event(2, Level = EventLevel.Warning)]
private void LatencyOverThreshold(string message)
private void ThresholdViolation(string message)
{
this.WriteEvent(2, message);
}
Expand All @@ -91,17 +85,5 @@ private void FailedRequest(string message)
{
this.WriteEvent(3, message);
}

[Event(4, Level = EventLevel.Warning)]
private void RequestChargeOverThreshold(string message)
{
this.WriteEvent(4, message);
}

[Event(5, Level = EventLevel.Warning)]
private void PayloadSizeOverThreshold(string message)
{
this.WriteEvent(5, message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -343,16 +343,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -680,16 +680,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -1017,16 +1017,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -1354,16 +1354,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -1691,16 +1691,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -2028,16 +2028,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -2365,16 +2365,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -2702,16 +2702,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -3039,16 +3039,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down Expand Up @@ -3376,16 +3376,16 @@
<ATTRIBUTE key="db.cosmosdb.request_charge">Some Value</ATTRIBUTE>
<ATTRIBUTE key="db.cosmosdb.activity_id">Some Value</ATTRIBUTE>
</ACTIVITY>
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="LatencyOverThreshold" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
<EVENT name="ThresholdViolation" />
</OTelActivities></Output>
</Result>
<Result>
Expand Down
Loading

0 comments on commit 1971185

Please sign in to comment.