Skip to content

Commit

Permalink
Merge pull request #829 from sitkoru/modules/sentry/default-tags
Browse files Browse the repository at this point in the history
feat(sentry): set default tags with app info
  • Loading branch information
SonicGD authored Apr 27, 2023
2 parents e301ad2 + 9e50df6 commit 9ef504f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Sitko.Core.App/IApplicationContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private ApplicationOptions GetApplicationOptions()

if (string.IsNullOrEmpty(applicationOptions.Environment))
{
applicationOptions.Version = AspNetEnvironmentName;
applicationOptions.Environment = AspNetEnvironmentName;
}

ConfigureApplicationOptions(applicationOptions);
Expand Down
4 changes: 4 additions & 0 deletions src/Sitko.Core.Sentry/SentryModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ public void PostConfigureHostBuilder(IApplicationContext context, IHostBuilder h
o.Dsn = startupOptions.Dsn;
o.Debug = startupOptions.EnableDebug;
o.TracesSampleRate = startupOptions.TracesSampleRate;
o.DefaultTags.Add("ServiceId", context.Id.ToString());
o.DefaultTags.Add("Service", context.Name);
o.DefaultTags.Add("Environment", context.Environment);
o.DefaultTags.Add("Version", context.Version);
startupOptions.ConfigureSentryOptions?.Invoke(context, o, startupOptions);
});
});
Expand Down

0 comments on commit 9ef504f

Please sign in to comment.