Skip to content

feat: sdk type in metrics metadata #92

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

Merged
merged 5 commits into from
Apr 29, 2025
Merged

Conversation

kwasniew
Copy link
Contributor

@kwasniew kwasniew commented Apr 29, 2025

About the changes

Modelling frontend and backend sdk type. This will be used by Unleash to handle frontend and backend apps separately.

Design decisions:

  • instead of creating composite type for the Sdk I decided to have 2 separate fields so that it's easier to evolve existing code. The tradeoff is that we can have sdk version indicating it's a backend SDK while the type being frontend SDK.
  • SdkType is not a string on purpose so that we don't see weird SDK types being reported. It requires more work (derives + ToSchema for openapi)

Important files

Discussion points

@@ -146,12 +146,19 @@ pub struct ClientApplication {
pub metadata: MetricsMetadata,
}

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq, Eq)]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

we can't derive builder on enums

@kwasniew kwasniew requested a review from chriswk April 29, 2025 09:53
@@ -417,6 +428,7 @@ mod tests {
"instanceId": "test-instance-id",
"connectionId": "test-connection-id",
"sdkVersion": "rust-1.3.0",
"sdkType": "backend",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

lowercase from serde

Copy link
Member

Choose a reason for hiding this comment

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

So.
If I remember correctly serde's rename lowercase doesn't work on enums. I think you have to use strum
#[strum(serialize_all = "lowercase")]

Copy link
Member

Choose a reason for hiding this comment

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

Ah, but I see you have tests, ignore me then.

Copy link
Member

@chriswk chriswk left a comment

Choose a reason for hiding this comment

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

Looks fine to me. Have a +1

@kwasniew kwasniew merged commit 1178e74 into main Apr 29, 2025
4 checks passed
@kwasniew kwasniew deleted the metrics-metadata-sdk-type branch April 29, 2025 13:19
@unleash-bot unleash-bot bot mentioned this pull request Apr 29, 2025
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