Skip to content

feat(amazonq): LSP telemetry/event messages trigger client side telemetry service calls #5511

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 27 commits into
base: feature/q-lsp-chat
Choose a base branch
from

Conversation

samgst-amazon
Copy link
Contributor

LSP client handles telemetry/event messages sent from the server

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)

Description

the generic TelemetryService.record() is used to dynamically send telemetry calls received from the server.

Checklist

  • My code follows the code style of this project
  • I have added tests to cover my changes
  • A short description of the change has been added to the CHANGELOG if the change is customer-facing in the IDE.
  • I have added metrics for my changes (if required)

License

I confirm that my contribution is made under the terms of the Apache 2.0 license.

@samgst-amazon samgst-amazon requested a review from a team as a code owner March 26, 2025 00:19
Copy link

github-actions bot commented Mar 26, 2025

Qodana Community for JVM

It seems all right 👌

No new problems were found according to the checks applied

💡 Qodana analysis was run in the pull request mode: only the changed files were checked
☁️ View the detailed Qodana report

Contact Qodana team

Contact us at [email protected]

import java.util.concurrent.CompletableFuture

/**
* Concrete implementation of [AmazonQLanguageClient] to handle messages sent from server
*/
class AmazonQLanguageClientImpl(private val project: Project) : AmazonQLanguageClient {
override fun telemetryEvent(`object`: Any) {
println(`object`)
when (`object`) {
is MutableMap<*, *> -> handleTelemetryMap(`object`)
Copy link
Contributor

Choose a reason for hiding this comment

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

warn for the other case?

TelemetryService.getInstance().record(project) {
datum(name) {
createTime(Instant.now())
unit(telemetryMap["unit"] as? MetricUnit ?: MetricUnit.NONE)
Copy link
Contributor

Choose a reason for hiding this comment

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

how does Flare model this event? i'm not sure if Gson will magically deserialize into these types

val name = telemetryMap["name"] as? String ?: return

@Suppress("UNCHECKED_CAST")
val data = telemetryMap["data"] as? Map<String, Any> ?: return
Copy link
Contributor Author

Choose a reason for hiding this comment

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

is this the correct action here? are there any telemetry events we want to be emitting that would have no data?

@rli rli deleted the branch feature/q-lsp-chat April 18, 2025 19:44
@rli rli closed this Apr 18, 2025
@rli rli reopened this Apr 18, 2025
@rli rli changed the base branch from feature/q-lsp to main April 18, 2025 19:48
samgst-amazon and others added 4 commits April 18, 2025 12:59
# Conflicts:
#	plugins/amazonq/shared/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImpl.kt
#	plugins/amazonq/shared/jetbrains-community/tst/software/aws/toolkits/jetbrains/services/amazonq/lsp/AmazonQLanguageClientImplTest.kt
@samgst-amazon samgst-amazon changed the base branch from main to feature/q-lsp-chat May 9, 2025 18:19
@samgst-amazon samgst-amazon requested a review from a team as a code owner May 9, 2025 21:27

TelemetryService.getInstance().record(project) {
datum(name) {
createTime(Instant.now())
Copy link
Contributor

Choose a reason for hiding this comment

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

time should be extracted from the metric?

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.

2 participants