-
Notifications
You must be signed in to change notification settings - Fork 3
parquet statistic, logging for accreditationlist, added danlogger ext… #199
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ension method and log action
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Only minor feedback on the naming of the new method and route, but looks okie
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds Parquet-based usage statistics per service context, enriches accreditation logging, and tracks service ownership.
- Introduces
GetLast24HoursPerServiceContextreturning aParquetSourceand wires it up inFuncUsageStatisticsas a newDigdirStatisticsendpoint. - Extends service contexts with an
Ownerproperty and hardcodes owner values inServiceContextService. - Adds a new
DanLogoverload inILoggerExtensionand injectsILoggerinto function classes.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Dan.Core/Services/UsageStatisticsService.cs | New method to query last 24h stats and build a Parquet payload. |
| Dan.Core/Services/ServiceContextService.cs | Populates Owner on each ServiceContext entry. |
| Dan.Core/Models/ParquetSource.cs | Defines ParquetSource and record model. |
| Dan.Core/FuncUsageStatistics.cs | Adds DigdirStatistics function, Parquet serialization, logging. |
| Dan.Core/FuncAccreditationList.cs | Injects ILogger, logs accreditation retrieval action. |
| Dan.Core/Extensions/ILoggerExtension.cs | Adds new DanLog overload. |
| Dan.Core/Dan.Core.csproj | Includes Parquet.Net package and local settings in output. |
| Dan.Common/Models/ServiceContext.cs | Adds Owner data member to ServiceContext. |
| Dan.Common/Enums/LogAction.cs | Adds AccreditationsRetrieved log action enum. |
Comments suppressed due to low confidence (4)
Dan.Core/FuncUsageStatistics.cs:25
- The original endpoint was annotated with
NoAuthentication, but this attribute was removed. Re-add, NoAuthenticationif public access without auth is intended.
[Function("MonthlyUsageStatistics")]
Dan.Core/FuncUsageStatistics.cs:64
- New
DigdirStatisticsendpoint should have corresponding unit or integration tests to verify Parquet serialization and response behavior.
[Function("DigdirStatistics"), NoAuthentication]
Dan.Core/Services/UsageStatisticsService.cs:53
- Consider adding XML documentation for this new public method to explain its purpose, query time range, and returned data structure.
public async Task<ParquetSource> GetLast24HoursPerServiceContext()
Dan.Core/Extensions/ILoggerExtension.cs:53
- The code uses Path.GetFileNameWithoutExtension but the file does not import System.IO. Add
using System.IO;to resolve the reference.
Path.GetFileNameWithoutExtension(callingClass), callingMethod, null, "", "", owner, requestor, "","", DateTime.UtcNow, serviceContext);
| ServiceOwner = serviceContexts | ||
| .FirstOrDefault(s => s.Name == row["serviceContext"].ToString()).Owner |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FirstOrDefault may return null if a serviceContext isn't found, causing a NullReferenceException. Consider using a dictionary lookup or null-check before accessing .Owner.
| ServiceOwner = serviceContexts | |
| .FirstOrDefault(s => s.Name == row["serviceContext"].ToString()).Owner | |
| ServiceOwner = serviceContexts.TryGetValue(row["serviceContext"].ToString(), out var owner) | |
| ? owner | |
| : string.Empty |
| ServiceOwner = serviceContexts | ||
| .FirstOrDefault(s => s.Name == row["serviceContext"].ToString()).Owner |
Copilot
AI
Jul 10, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Performing FirstOrDefault inside the loop can be inefficient for large result sets. Consider building a lookup dictionary once before iterating.
| ServiceOwner = serviceContexts | |
| .FirstOrDefault(s => s.Name == row["serviceContext"].ToString()).Owner | |
| ServiceOwner = serviceContextLookup.TryGetValue(row["serviceContext"].ToString(), out var owner) ? owner : null |
|



…ension method and log action
Description
Documentation