arolariu.Backend.Common
arolariu.Backend.Common
arolariu.Backend.Common Namespace
Classes
CommonMetrics Class
Defines custom OTel metric instruments for the Common package (infrastructure metrics). All instruments are created from CommonMeter.
public static class CommonMetrics
Inheritance System.Object 🡒 CommonMetrics
Remarks
Metric naming follows OTel semantic conventions:
config.refresh.*— Configuration proxy refresh cycle metrics
Fields
CommonMetrics.ConfigRefreshDuration Field
Duration of configuration refresh cycles in milliseconds.
public static readonly Histogram<double> ConfigRefreshDuration;
Field Value
System.Diagnostics.Metrics.Histogram<System.Double>
CommonMetrics.ConfigRefreshFailure Field
Total number of failed configuration refresh cycles.
public static readonly Counter<long> ConfigRefreshFailure;
Field Value
System.Diagnostics.Metrics.Counter<System.Int64>
CommonMetrics.ConfigRefreshSuccess Field
Total number of successful configuration refresh cycles.
public static readonly Counter<long> ConfigRefreshSuccess;
Field Value
System.Diagnostics.Metrics.Counter<System.Int64>
GuidConstants Class
Provides well-known GUID constants used throughout the application for sentinel values and special identifiers.
public static class GuidConstants
Inheritance System.Object 🡒 GuidConstants
Remarks
Purpose: These constants define system-wide sentinel GUIDs that carry semantic meaning across all bounded contexts. Using constants instead of inline values ensures consistency, prevents typos, and enables refactoring safety.
EMPTY_GUID: Represents the minimum GUID value (all zeros). Used to indicate an uninitialized or guest/anonymous user state.
LAST_GUID: Represents the maximum GUID value (all nines). Used as a sentinel to indicate public/unrestricted access.
When present in the SharedWith collection of an invoice, it means the invoice is publicly accessible.
Fields
GuidConstants.EmptyGuid Field
The minimum GUID value (all zeros): 00000000-0000-0000-0000-000000000000.
public static readonly Guid EmptyGuid;
Field Value
Remarks
Used to represent:
- Uninitialized entity identifiers
- Guest or anonymous user state
- Absence of a reference (null alternative)
GuidConstants.LastGuid Field
The maximum GUID value (all nines): 99999999-9999-9999-9999-999999999999.
public static readonly Guid LastGuid;
Field Value
Remarks
Used to represent:
- Public access sentinel in sharing contexts
- Unrestricted visibility marker
Example: When an invoice's SharedWith collection contains this GUID,
the invoice is considered publicly accessible to all users, including guests.
Log Class
Provides source-generated, zero-allocation logging methods for the Common package. Covers Key Vault configuration loading and configuration proxy refresh workflows.
public static class Log
Inheritance System.Object 🡒 Log
Remarks
Event ID scheme for the Common package:
0–99— OTel setup and Key Vault configuration loading410_1xx— Configuration proxy refresh lifecycle410_2xx— Configuration proxy client errors
Methods
Log.LogBootstrapMissing(this ILogger) Method
Logs when config values are unavailable during a refresh cycle. Config and feature snapshots are retained from the previous cycle.
public static void LogBootstrapMissing(this Microsoft.Extensions.Logging.ILogger logger);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance.
Log.LogConfigKeyDeserializationError(this ILogger, Exception, string) Method
Logs a JSON deserialization failure for a config key response.
public static void LogConfigKeyDeserializationError(this Microsoft.Extensions.Logging.ILogger logger, System.Exception exception, string key);
Parameters
logger Microsoft.Extensions.Logging.ILogger
exception System.Exception
key System.String
Log.LogConfigKeyHttpError(this ILogger, int, string) Method
Logs a non-success HTTP status code from the exp service for a config key.
public static void LogConfigKeyHttpError(this Microsoft.Extensions.Logging.ILogger logger, int statusCode, string key);
Parameters
logger Microsoft.Extensions.Logging.ILogger
statusCode System.Int32
key System.String
Log.LogConfigKeyNetworkError(this ILogger, Exception, string) Method
Logs a network-level error when the exp service is unreachable.
public static void LogConfigKeyNetworkError(this Microsoft.Extensions.Logging.ILogger logger, System.Exception exception, string key);
Parameters
logger Microsoft.Extensions.Logging.ILogger
exception System.Exception
key System.String
Log.LogConfigKeyTimeout(this ILogger, Exception, string) Method
Logs a timeout when fetching a config key from the exp service.
public static void LogConfigKeyTimeout(this Microsoft.Extensions.Logging.ILogger logger, System.Exception exception, string key);
Parameters
logger Microsoft.Extensions.Logging.ILogger
exception System.Exception
key System.String
Log.LogFeatureSnapshotUpdated(this ILogger, int) Method
Logs the successful update of the feature snapshot cache during a refresh cycle.
public static void LogFeatureSnapshotUpdated(this Microsoft.Extensions.Logging.ILogger logger, int featureCount);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance.
featureCount System.Int32
The number of feature flags in the updated snapshot.
Log.LogOptionValueFromConfiguration(this ILogger, string) Method
Logs successful retrieval of a configuration option from local configuration files.
public static void LogOptionValueFromConfiguration(this Microsoft.Extensions.Logging.ILogger logger, string propertyName);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance to write the message to.
propertyName System.String
The name of the configuration property that was loaded from files.
Log.LogOptionValueFromKeyVault(this ILogger, string, string) Method
Logs successful retrieval of a configuration option from Azure Key Vault.
public static void LogOptionValueFromKeyVault(this Microsoft.Extensions.Logging.ILogger logger, string propertyName, string keyVaultName);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance to write the message to.
propertyName System.String
The name of the configuration property that was loaded.
keyVaultName System.String
The name of the Key Vault from which the value was retrieved.
Log.LogOptionValueIsCompletelyMissing(this ILogger, string, string) Method
Logs a critical error when a required configuration option is missing from both configuration files and Key Vault.
public static void LogOptionValueIsCompletelyMissing(this Microsoft.Extensions.Logging.ILogger logger, string propertyName, string keyVaultName);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance to write the message to.
propertyName System.String
The name of the missing configuration property.
keyVaultName System.String
The name of the Key Vault that was checked for the missing value.
Log.LogRefreshFailed(this ILogger, Exception, TimeSpan) Method
Logs refresh failures and next retry interval.
public static void LogRefreshFailed(this Microsoft.Extensions.Logging.ILogger logger, System.Exception exception, System.TimeSpan interval);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance.
exception System.Exception
The exception encountered during refresh.
interval System.TimeSpan
The retry interval.
Log.LogRefreshSucceeded(this ILogger) Method
Logs successful configuration and feature refresh from the proxy.
public static void LogRefreshSucceeded(this Microsoft.Extensions.Logging.ILogger logger);
Parameters
logger Microsoft.Extensions.Logging.ILogger
The logger instance.