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

Update OpenAI OpenTelemetry integration to pass an ILogger #7771

Open
eerhardt opened this issue Feb 25, 2025 · 0 comments · May be fixed by #7799
Open

Update OpenAI OpenTelemetry integration to pass an ILogger #7771

eerhardt opened this issue Feb 25, 2025 · 0 comments · May be fixed by #7799
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Milestone

Comments

@eerhardt
Copy link
Member

See the conversation at dotnet/eShop#759 (comment)

Today the Aspire integration enables OpenTelemetry unless someone disables tracing:

return builder.DisableTracing
? result
: new OpenTelemetryEmbeddingGenerator<string, Embedding<float>>(result);

but diffing this code with what's in UseOpenTelemetry(), maybe we need to update it to pass an ILogger in:

https://github.com/dotnet/extensions/blob/576fa221f57f80423a4852e446cee2aa2e937aab/src/Libraries/Microsoft.Extensions.AI/Embeddings/OpenTelemetryEmbeddingGeneratorBuilderExtensions.cs#L36-L43

            loggerFactory ??= services.GetService<ILoggerFactory>();


            var generator = new OpenTelemetryEmbeddingGenerator<TInput, TEmbedding>(
                innerGenerator,
                loggerFactory?.CreateLogger(typeof(OpenTelemetryEmbeddingGenerator<TInput, TEmbedding>)),
                sourceName);
            configure?.Invoke(generator);
            return generator;

That way someone doesn't need to call UseLogging().

@eerhardt eerhardt added the area-integrations Issues pertaining to Aspire Integrations packages label Feb 25, 2025
@eerhardt eerhardt added this to the 9.2 milestone Feb 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-integrations Issues pertaining to Aspire Integrations packages
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant