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

feat: add sdk infomation metrics #2208

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft

feat: add sdk infomation metrics #2208

wants to merge 7 commits into from

Conversation

whynowy
Copy link
Member

@whynowy whynowy commented Nov 6, 2024

# HELP sdk_info A metric with a constant value '1', labeled by SDK information such as version, language, and type.
# TYPE sdk_info gauge
sdk_info{language="rust",version="0.1.1",type="sourcetransformer"} 1
sdk_info{language="rust",version="0.1.1",type="sourcer"} 1
sdk_info{language="rust",version="0.1.1",type="sinker"} 1

Signed-off-by: Derek Wang <[email protected]>
Signed-off-by: Derek Wang <[email protected]>
Signed-off-by: Derek Wang <[email protected]>
@whynowy whynowy requested a review from vigith as a code owner November 6, 2024 18:09
@whynowy whynowy marked this pull request as draft November 6, 2024 18:09
.
Signed-off-by: Derek Wang <[email protected]>
@@ -18,6 +18,17 @@ use crate::shared::server_info::version::SdkConstraints;
// Equivalent to U+005C__END__.
const END: &str = "U+005C__END__";

pub const CONTAINER_TYPE_SOURCER: &str = "sourcer";
Copy link
Member Author

Choose a reason for hiding this comment

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

What is the best way to do this in rust?

Copy link
Contributor

Choose a reason for hiding this comment

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

Enum?

Copy link
Member Author

Choose a reason for hiding this comment

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

Enum with string? Not seems to work.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do you want something like this?
#2020

Copy link
Member Author

Choose a reason for hiding this comment

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

Constant seems to be simpler for this specific use case.

Copy link
Member

Choose a reason for hiding this comment

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

idiomatic rust is to use enum and impl std::fmt::Display for getting the string version string.

@KeranYang
Copy link
Member

do we need extra pipeline and vertex name dimensions? one pipeline can have multiple vertices using different SDK versions

@KeranYang
Copy link
Member

And just curious, what is the main use case of introducing this metric?

@whynowy
Copy link
Member Author

whynowy commented Nov 6, 2024

And just curious, what is the main use case of introducing this metric?

This can be used to know what are the sdk versions being in use, to help identify what version of controller can be upgraded, assume we would have a backward compatibility mapping for the controller and sdks.

@whynowy
Copy link
Member Author

whynowy commented Nov 6, 2024

do we need extra pipeline and vertex name dimensions? one pipeline can have multiple vertices using different SDK versions

No need for that I think.

Comment on lines 404 to 405
// forward_metrics_labels is a helper function used to fetch the
// SDK_INFO_LABELS object
Copy link
Member

Choose a reason for hiding this comment

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

wrong comment?

Comment on lines +273 to +274
_ = sdk_server_info(ud_transformer.socket_path.clone().into(), cln_token.clone())
.await?;
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
_ = sdk_server_info(ud_transformer.socket_path.clone().into(), cln_token.clone())
.await?;
_ = sdk_server_info(ud_transformer.socket_path.clone().into(), cln_token.clone())
.await?;

do we need this change?

Copy link
Member Author

@whynowy whynowy Nov 6, 2024

Choose a reason for hiding this comment

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

Do we need to handle the return in rust? Also, I assume something needs to be added for the returned server info later on - this is for pipeline.

Copy link
Member

Choose a reason for hiding this comment

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

? does the return on error. the success is a zero-size-type () which has no meaning.

Copy link
Member Author

Choose a reason for hiding this comment

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

The success is changed to ServerInfo.

Copy link
Member

Choose a reason for hiding this comment

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

then it is fine, i missed that

@@ -18,6 +18,17 @@ use crate::shared::server_info::version::SdkConstraints;
// Equivalent to U+005C__END__.
const END: &str = "U+005C__END__";

pub const CONTAINER_TYPE_SOURCER: &str = "sourcer";
Copy link
Member

Choose a reason for hiding this comment

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

idiomatic rust is to use enum and impl std::fmt::Display for getting the string version string.

Comment on lines +189 to +190
_ = sdk_server_info(ud_config.server_info_path.clone().into(), cln_token.clone())
.await?;
Copy link
Member

Choose a reason for hiding this comment

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

any reason for this change?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same reason as the other one.

Signed-off-by: Derek Wang <[email protected]>
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.

4 participants