Skip to content

Commit

Permalink
removed sampling and added errorhandling
Browse files Browse the repository at this point in the history
  • Loading branch information
Torkelsen committed Oct 11, 2024
1 parent 2013b3f commit baab22c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
17 changes: 14 additions & 3 deletions handlenett-backend/serverless/functions/ItemsChangeFeed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,21 @@ public void Run([CosmosDBTrigger(
CreateLeaseContainerIfNotExists = true)] IReadOnlyList<MyDocument> input)
{

if (input != null && input.Count > 0)
try
{
_logger.LogInformation("Documents modified: " + input.Count);
_logger.LogInformation("First document Id: " + input[0].id);
if (input != null && input.Count > 0)
{
_logger.LogInformation("Documents modified: " + input.Count);
_logger.LogInformation("First document Id: " + input[0].id);
}
else
{
_logger.LogInformation("Input was null or empty.");
}
}
catch (Exception ex)
{
_logger.LogError(ex, "An error occurred while processing the Cosmos DB trigger.");
}
}
}
Expand Down
3 changes: 1 addition & 2 deletions handlenett-backend/serverless/functions/host.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
},
"applicationInsights": {
"samplingSettings": {
"isEnabled": true,
"excludedTypes": "Request"
"isEnabled": false
}
}
}
Expand Down

0 comments on commit baab22c

Please sign in to comment.