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

fix/tracing: Add Client Platform and agentVersion to traces #6889

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

Conversation

arafatkatze
Copy link
Contributor

@arafatkatze arafatkatze commented Jan 30, 2025

Part of CODY-4771. Adds agent version and ClientPlatform in OpenTelemetryService.

NOTE: the version string uses pre-release and release versions properly and @abeatrix confirmed that too. The version string is what is actually the value of clientCapabilities.agentExtensionVersion

Test plan

Tested locally with the debugger

  • Run a local sourcegraph instance with sg start
  • Run Open Telemetry Collector with sg start otel
  • Run this branch on Cody repo with the debugger
image
  • Make sure that the account used in Cody is local Sg instance account
  • Go to the URL http://localhost:16686/-/debug/jaeger this shows you the local traces
  • Checkout webview service
image

Look into your specific chat trace(which will give you Client Platform and agent Version )

image

@arafatkatze arafatkatze requested review from dominiccooney and removed request for dominiccooney January 30, 2025 18:00
@arafatkatze arafatkatze changed the title Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service [wip] Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Jan 30, 2025
@arafatkatze arafatkatze changed the title [wip] Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Jan 31, 2025
@@ -45,7 +48,7 @@ export class OpenTelemetryService {
this.tracerProvider = new NodeTracerProvider({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'cody-client',
[SemanticResourceAttributes.SERVICE_VERSION]: version,
[SemanticResourceAttributes.SERVICE_VERSION]: clientCapabilities().agentExtensionVersion,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Its the same value so I wanted to maintain consistency in the usage of agentExtensionVersion

@dominiccooney
Copy link
Contributor

  • Link to Linear issues with the text syntax like CODY-1234.
  • Write a real test plan. How do you test it locally with the debugger? A teammate unfamiliar with this is not going to be able to reproduce your test as written.

@arafatkatze
Copy link
Contributor Author

@dominiccooney Thanks for the pointers I updated the PR description properly.

@arafatkatze arafatkatze changed the title Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service CODY-4711: Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Feb 3, 2025
@arafatkatze arafatkatze changed the title CODY-4711: Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Part of CODY-4711: Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service Feb 3, 2025
@dominiccooney
Copy link
Contributor

The version string is what is actually the value of clientCapabilities.agentExtensionVersion

Right, and where does JetBrains, VS, etc. set that?

@dominiccooney dominiccooney changed the title Part of CODY-4711: Adding Client Platform and agentVersion to Exported Traces in OpenTelemetry Service fix/tracing: Add Client Platform and agentVersion to traces Feb 3, 2025
@dominiccooney
Copy link
Contributor

You should literally just write CODY-4711. There's GitHub integration that linkifies it.

You should remove scree like <!-- Required. See https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles. --> ... I have done it for you.

Copy link
Contributor

@dominiccooney dominiccooney left a comment

Choose a reason for hiding this comment

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

Some naming comments inline.

@@ -14,8 +14,8 @@ export class WebviewOpenTelemetryService {
private unloadInstrumentations?: () => void
private isTracingEnabled = false
private isInitialized = false
private agentIDE?: CodyIDE
private extensionAgentVersion?: string
private clientPlatform?: CodyIDE
Copy link
Contributor

Choose a reason for hiding this comment

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

Why name it this? I guess the IDE is a platform in some sense, but I think if you took a poll of cody core devs about what "clientPlatform" means and most would say macOS/Windows/etc.

Copy link
Contributor Author

@arafatkatze arafatkatze Feb 3, 2025

Choose a reason for hiding this comment

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

I wanted to keep the word client somewhere because we use server for sourcegraph instance and client for whether its Vscode Cody or jetbrains etc. But I see your point now.

But how about we just keep it clientIde or ideClient ? WE might also editorClient. I am not the best with naming so it would be great if you can pick something from these choices as to me they are all VERY close.

Copy link
Contributor

Choose a reason for hiding this comment

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

If it is the IDE, then how about private ide: CodyIDE?

It is not ideal because not everything is an IDE, but until we fix the CodyIDE type name, should be an ok field name.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Even simpler. Let's just do that.

Copy link
Contributor

Choose a reason for hiding this comment

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

...I see you're adding the same name to Telemetry. How about editor? It doesn't quite stretch to the command line but it covers everything else well.

Or maybe application?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am ambivalent between editor and ide they both mean the same to me. Application wouldn't be good, I think of something foreign.

private agentIDE?: CodyIDE
private extensionAgentVersion?: string
private clientPlatform?: CodyIDE
private agentVersion?: string
Copy link
Contributor

Choose a reason for hiding this comment

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

This is unclear to me too. Let's pick a better name and consider adding a comment.

First, unclear whether this refers to the IDE version, like v7.65.0-nightly or v1.66.0, or some version of the src/agent, src/vscode, etc. code. "agent" did imply the latter. These days the IDE version is the most useful thing to have. But above all, unclear to me what this is.

Second, we need to give up the term "Agent" for @olafurpg & crew's latest effort. There's no clear replacement term yet, unfortunately. But just saying "agent" is not great.

Copy link
Member

Choose a reason for hiding this comment

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

For time being, I think the name "Cody Agent" is distinct enough to minimize confusion while avoiding the need for a large rewrite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I used agentversion for the same reasons as you described above but I see how that's a confusing naming.

How about we do something much simpler like codyExtensionVersion or extensionVersion?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep, I'm not asking for a rewrite here. But by the same token I don't want to introduce an undifferentiated "agent". Particularly if the name goes to Telemetry logs and we're going to be living with it for a long time.

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

Successfully merging this pull request may close these issues.

3 participants