Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow some way to set/influence InstrumentationScope for logs #4867

Closed
JakeDern opened this issue Sep 19, 2023 · 1 comment · Fixed by #4941
Closed

Allow some way to set/influence InstrumentationScope for logs #4867

JakeDern opened this issue Sep 19, 2023 · 1 comment · Fixed by #4941
Labels
enhancement New feature or request

Comments

@JakeDern
Copy link

Feature Request

Before opening a feature request against this repo, consider whether the feature
should/could be implemented in the other OpenTelemetry client
libraries
. If so, please open an issue on
opentelemetry-specification

first.

Is your feature request related to a problem?

Instrumentation scope is a valuable field and is present on ScopeLogs, ScopeMetrics, and ScopeSpans proto models. As described in the glossary instrumentation scope is a good place to differentiate logs coming from a particular module, package, or class which is exactly what we are looking to use them for.

From what I can tell this field remains untouched by the dotnet implementation when converting log records into open telemetry form, see here. It is used, however, in metrics and activities

Describe the solution you'd like:

Any way to influence this field on logs for a particular scope within an application would be valuable. Tying it in some way to activities or ILogger.BeginScope are two ideas that come to mind. Setting it manually at each ILogger.Log callsite would be undesirable and error prone.

LogRecord.CategoryName Seems to be set automatically based on the class that the log record is for and a similar strategy could be acceptable here as well, though I'm not sure mapping the fields 1:1 is the right approach.

Describe alternatives you've considered.

We can (and probably will) make use of attributes to fill this gap for now, but it's unfortunate given that there is a dedicated field for this and we can't make use of it.

Additional Context

None.

@JakeDern JakeDern added the enhancement New feature or request label Sep 19, 2023
@vishweshbankwar
Copy link
Member

Related #3491

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
2 participants