Skip to content

java v2: client wrapper instrumentation #7638

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

lmolkova
Copy link
Member

No description provided.

@microsoft-github-policy-service microsoft-github-policy-service bot added the emitter:client:java Issue for the Java client emitter: @typespec/http-client-java label Jun 13, 2025
Copy link
Contributor

No changes needing a change description found.

@azure-sdk
Copy link
Collaborator

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@@ -115,6 +116,7 @@ public class ClientMethod {
private final boolean hasWithContextOverload;
private final String parametersDeclaration;
private final String argumentList;
private final Operation operation;
Copy link
Contributor

@weidongxu-microsoft weidongxu-microsoft Jun 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should not set the Operation object into the ClientMethod. It creates too much coupling.

If you really have to, you can put something like String methodInstructionId that capture your current value.

Also, I am not sure about the intention of

        String operationName
            = String.format("%s.%s", operation.getOperationGroup().getLanguage().getDefault().getName(),
                operation.getLanguage().getDefault().getName());

As you can see, lots of regenerated code now looks like this

        return this.instrumentation.instrumentWithResponse(".valid", requestContext,

I am not sure whether the .valid is a good name.

The name in operationGroup may not be what was in Swagger. TypeSpec would have client.tsp to rearrange the operation groups, and here the name would have no relation to what in their REST API doc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
emitter:client:java Issue for the Java client emitter: @typespec/http-client-java
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants