Use App and Version when doing otel service name (#61)
This commit is contained in:
@@ -63,8 +63,8 @@ public static class Setup
|
||||
//start mutex so that Manager can detect if this process is running
|
||||
Mutex = new Mutex(false, "SpeckleConnector-" + configuration.Application);
|
||||
|
||||
var traceProvider = TraceBuilder.Initialize(Application, Slug, configuration.Tracing);
|
||||
LogBuilder.Initialize(GetUserIdFromDefaultAccount(), Application, Slug, configuration.Logging);
|
||||
var traceProvider = TraceBuilder.Initialize(ApplicationVersion, Slug, configuration.Tracing);
|
||||
LogBuilder.Initialize(GetUserIdFromDefaultAccount(), ApplicationVersion, Slug, configuration.Logging);
|
||||
|
||||
foreach (var account in AccountManager.GetAccounts())
|
||||
{
|
||||
|
||||
@@ -10,7 +10,12 @@ namespace Speckle.Logging;
|
||||
|
||||
public static class LogBuilder
|
||||
{
|
||||
public static void Initialize(string userId, string hostApplication, string? slug, SpeckleLogging? speckleLogging)
|
||||
public static void Initialize(
|
||||
string userId,
|
||||
string applicationAndVersion,
|
||||
string? slug,
|
||||
SpeckleLogging? speckleLogging
|
||||
)
|
||||
{
|
||||
var fileVersionInfo = GetFileVersionInfo();
|
||||
var serilogLogConfiguration = new LoggerConfiguration()
|
||||
@@ -28,7 +33,7 @@ public static class LogBuilder
|
||||
if (speckleLogging?.File is not null)
|
||||
{
|
||||
// TODO: check if we have write permissions to the file.
|
||||
var logFilePath = SpecklePathProvider.LogFolderPath(hostApplication, slug);
|
||||
var logFilePath = SpecklePathProvider.LogFolderPath(applicationAndVersion, slug);
|
||||
logFilePath = Path.Combine(logFilePath, speckleLogging.File.Path ?? "SpeckleCoreLog.txt");
|
||||
serilogLogConfiguration = serilogLogConfiguration.WriteTo.File(
|
||||
logFilePath,
|
||||
@@ -51,7 +56,7 @@ public static class LogBuilder
|
||||
o.Headers = speckleLogging.Otel.Headers ?? o.Headers;
|
||||
o.ResourceAttributes = new Dictionary<string, object>
|
||||
{
|
||||
[Consts.SERVICE_NAME] = hostApplication,
|
||||
[Consts.SERVICE_NAME] = applicationAndVersion,
|
||||
[Consts.SERVICE_SLUG] = slug ?? string.Empty
|
||||
};
|
||||
});
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace Speckle.Logging;
|
||||
|
||||
public class TraceBuilder(IDisposable? traceProvider) : IDisposable
|
||||
{
|
||||
public static IDisposable? Initialize(string application, string slug, SpeckleTracing? logConfiguration)
|
||||
public static IDisposable? Initialize(string applicationAndVersion, string slug, SpeckleTracing? logConfiguration)
|
||||
{
|
||||
var consoleEnabled = logConfiguration?.Console ?? false;
|
||||
var otelEnabled = logConfiguration?.Otel?.Enabled ?? false;
|
||||
@@ -23,7 +23,7 @@ public class TraceBuilder(IDisposable? traceProvider) : IDisposable
|
||||
r.AddAttributes(
|
||||
new List<KeyValuePair<string, object>>
|
||||
{
|
||||
new(Consts.SERVICE_NAME, application),
|
||||
new(Consts.SERVICE_NAME, applicationAndVersion),
|
||||
new(Consts.SERVICE_SLUG, slug)
|
||||
}
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user