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

A Serilog sink that'd use OpenTelemetry SDK #159

Closed
srogovtsev opened this issue Sep 10, 2024 · 9 comments
Closed

A Serilog sink that'd use OpenTelemetry SDK #159

srogovtsev opened this issue Sep 10, 2024 · 9 comments

Comments

@srogovtsev
Copy link
Contributor

First, I want to make clear that this is not a feature request for Serilog.Sinks.OpenTelemetry, as this is very obviously contrary to its original design decision. It's just that I haven't found a better place to ask this question.

Is there any Serilog sink implementation that would rely on OpenTelemetry SDK?

The rationale is that if the system already uses OpenTelemetry SDK, the dependencies are not an issue, and going through the SDK for logs would allow them to share settings and, e.g., Resource definitions.

@srogovtsev srogovtsev added the enhancement New feature or request label Sep 10, 2024
@nblumhardt nblumhardt changed the title [Question] A Serilog sink that'd use OpenTelemetry SDK A Serilog sink that'd use OpenTelemetry SDK Sep 10, 2024
@nblumhardt nblumhardt added discussion and removed enhancement New feature or request labels Sep 10, 2024
@nblumhardt
Copy link
Member

Hi @srogovtsev!

I think @CodeBlanch had one of these in the works; I'm not sure where it landed, it may just be waiting to hit the top of the backlog :-) IIRC the project name was OpenTelemetry.Serilog.Sink.

If you're keen to dig in and put one of these together independently I'd be happy to help out. I don't have a use case for it myself so not much of an opportunity to dogfood, and no bandwidth to ship or maintain it, unfortunately, but I'm curious what it would look like and how smooth the integration can get.

@srogovtsev
Copy link
Contributor Author

Let's say, I'm interested at trying my hand at it, but I don't know what my workload would be either. But in our particular case it might be a more reasonable approach than trying to adapt Serilog.Sinks.OpenTelemetry to all our needs.

@srogovtsev
Copy link
Contributor Author

Were it not for the overhead, this could have been achieved by simply chaining Serilog.Sinks.ILogger and OpenTelemetry's own integration for M.E.L. But the overhead would be unreasonable.

@srogovtsev
Copy link
Contributor Author

srogovtsev commented Sep 13, 2024

Just as a record, it seems that I was too hasty with this whole idea: OpenTelemetry 1.9.0 (the latest at the time of writing) is very closed WRT logging infrastructure, so doing this right now seems unfeasible. But I'll keep an eye on it, and also dig somewhat.

@julealgon
Copy link

OpenTelemetry 1.9.0 (the latest at the time of writing) is very closed WRT logging infrastructure, so doing this right now seems unfeasible.

What do you mean by that @srogovtsev ? Doesn't it expose an implementation of Microsoft.Extensions.Logging.ILogger?

@srogovtsev
Copy link
Contributor Author

I mean that while it exposes an implementation of Microsoft.Extensions.Logging.ILogger, it doesn't expose telemetry-level primitives (i.e. there's no way to construct a LogRecord).

Using Microsoft.Extensions.Logging.ILogger will mean doing double conversion (first from Serilog to M.E.L, and then from M.E.L to OpenTelemetry), and not having ability to pass some data (e.g. Body or TraceId/SpanId) directly, which is also far from optimal.

@nblumhardt
Copy link
Member

I just had a quick poke around, I think the needed API is still internal in stable releases but might be available in prerelease packages: open-telemetry/opentelemetry-dotnet#4433

@ParadiseFallen
Copy link

+1

@nblumhardt
Copy link
Member

Closing as this isn't something we can implement here in this repo, but feel free to drop a link in here if you build or spot one of these out there. Thanks for the discussion @srogovtsev 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants