Skip to content
This repository was archived by the owner on Aug 14, 2024. It is now read-only.
This repository was archived by the owner on Aug 14, 2024. It is now read-only.

Log context conversion to tags #539

Open
@adinauer

Description

@adinauer

In some languages log context is available (e.g. Java and .NET). Think of it as a Hashmap / Dictionary where you can store values which will then be printed with every emitted log entry.

In Java this is called MDC (Mapped Diagnostic Context). Here are some examples:

Users have asked for context entries to be converted to Sentry tags (getsentry/sentry-java#1148 and getsentry/sentry-java#1054). This feature only existed in our .NET SDK. The config option there allows users to enable / disable the feature completely, but no fine grained control over which entries are converted to tags.

For Java we went with a bit more control over which entries will be picked up automatically from the MDC by adding a new config option called contextTags which can have a list of log context entry names (which have to match exactly, no glob / regex / similar for now). See this PR (getsentry/sentry-java#1954) for more detail.

Our idea for future improvement on this feature (if needed) was to support globs in addition to exact entry names, e.g. myPrefix.* to automatically convert all entries starting with myPrefix. as Sentry tags. We can then also use this to have a convention of automatically converting all entries starting with sentry.tag. by making the default ["sentry.tag.*"]. This convention was also part of the old Java SDK (1.x) [TODO link].

When something similar is implemented, the default should be to not create too many tags automatically as they come at a cost.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions