public LogAnalyticsLogTraceRepository(
     ILoggerFactory loggerFactory,
     HttpClient httpClient,
     LogAnalyticsConfiguration configuration,
     string accessToken)
     : base(
         loggerFactory,
         httpClient,
         configuration,
         accessToken,
         new[]
 {
     new LogAnalyticsEntityMap("TrackId", LogPropertyKeys.TrackId, $"LogProperties_{LogPropertyKeys.TrackId}_s"),
     new LogAnalyticsEntityMap("OperationName", LogPropertyKeys.TrackName, $"LogProperties_{LogPropertyKeys.TrackName}_s"),
     new LogAnalyticsEntityMap("TraceId", LogPropertyKeys.CorrelationId, $"LogProperties_{LogPropertyKeys.CorrelationId}_s"),
     new LogAnalyticsEntityMap("SpanId", LogPropertyKeys.TrackId, $"LogProperties_{LogPropertyKeys.TrackId}_s"),
     new LogAnalyticsEntityMap("ParentSpanId", LogPropertyKeys.TrackParentId, $"LogProperties_{LogPropertyKeys.TrackParentId}_s"),
     new LogAnalyticsEntityMap("Kind", LogPropertyKeys.TrackKind, $"LogProperties_{LogPropertyKeys.TrackKind}_s"),
     new LogAnalyticsEntityMap("Status", LogPropertyKeys.TrackStatus, $"LogProperties_{LogPropertyKeys.TrackStatus}_s"),
     new LogAnalyticsEntityMap("StatusDescription", LogPropertyKeys.TrackStatusDescription, $"LogProperties_{LogPropertyKeys.TrackStatusDescription}_s"),
     new LogAnalyticsEntityMap("StartTime", LogPropertyKeys.TrackStartTime, $"LogProperties_{LogPropertyKeys.TrackStartTime}_t"),
     new LogAnalyticsEntityMap("EndTime", LogPropertyKeys.TrackEndTime, $"LogProperties_{LogPropertyKeys.TrackEndTime}_t")
 })
 {
 }
Exemple #2
0
        public LogAnalyticsRepository( // TODO: use options+builder here
            ILoggerFactory loggerFactory,
            HttpClient httpClient,
            LogAnalyticsConfiguration configuration,
            string accessToken,
            IEnumerable <LogAnalyticsEntityMap> entityMap = null)
        {
            EnsureArg.IsNotNull(loggerFactory, nameof(loggerFactory));
            EnsureArg.IsNotNull(httpClient, nameof(httpClient));
            EnsureArg.IsNotNull(configuration, nameof(configuration));
            EnsureArg.IsNotNullOrEmpty(accessToken, nameof(accessToken));
            EnsureArg.IsNotNullOrEmpty(configuration.SubscriptionId, nameof(configuration.SubscriptionId));
            EnsureArg.IsNotNullOrEmpty(configuration.ResourceGroupName, nameof(configuration.ResourceGroupName));
            EnsureArg.IsNotNullOrEmpty(configuration.WorkspaceName, nameof(configuration.WorkspaceName));
            EnsureArg.IsNotNullOrEmpty(configuration.LogName, nameof(configuration.LogName));

            this.logger        = loggerFactory.CreateLogger <LogAnalyticsRepository <TEntity> >();
            this.httpClient    = httpClient;
            this.configuration = configuration;
            this.accessToken   = accessToken;
            this.entityMap     = LogAnalyticsEntityMap.CreateDefault()
                                 .Concat(entityMap.Safe()).DistinctBy(e => e.EntityProperty);

            this.logger.LogInformation($"{{LogKey:l}} construct loganalytics repository (type={typeof(TEntity).PrettyName()})", LogKeys.DomainRepository);
        }
Exemple #3
0
 public LogAnalyticsLogEventRepository(
     ILoggerFactory loggerFactory, // TODO: use optionsbuilder
     HttpClient httpClient,
     LogAnalyticsConfiguration configuration,
     string accessToken,
     IEnumerable <LogAnalyticsEntityMap> entityMap = null)
     : base(loggerFactory, httpClient, configuration, accessToken, entityMap)
 {
 }
 internal AppLogsConfiguration(string destination, LogAnalyticsConfiguration logAnalyticsConfiguration)
 {
     Destination = destination;
     LogAnalyticsConfiguration = logAnalyticsConfiguration;
 }