Skip to content

Conversation

@yashykt
Copy link
Member

@yashykt yashykt commented Dec 19, 2023

Provide a public experimental API and bazel compatible build target for OpenTelemetry metrics.

Details -

} // namespace internal

namespace experimental {
absl::string_view OpenTelemetryClientAttemptStartedInstrumentName() {
Copy link
Member

Choose a reason for hiding this comment

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

We may have already discussed this, but is there a reason why these need to be functions instead of just constexpr constants?

Copy link
Member Author

Choose a reason for hiding this comment

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

I had tried that some years ago but had ran into issues. Let me try it again and see if it works now.

Copy link
Member Author

Choose a reason for hiding this comment

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

pushed a canary change to see if the tests are happy with it. If they are, I'll use it for all.

Copy link
Member Author

Choose a reason for hiding this comment

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

seems to be working. Replaced all

namespace grpc {

namespace internal {
class OpenTelemetryPluginBuilderImpl;
Copy link
Member

Choose a reason for hiding this comment

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

I assume that once we have the plugin option API in place, there will no longer be any need for having two different layers here (the private API wrapped inside of the public API)?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, I think once the experimental CsmObservability API goes away, we won't need to do this.

Copy link
Member

Choose a reason for hiding this comment

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

It seems like we need the CSM plugin option implemented before we can remove the CsmObservability API. And once we have the CSM plugin option implemented, the CsmObservability code can use that plugin option in the public API, so it won't need to reach inside the internal API anymore. Or am I missing something here?

Copy link
Member Author

Choose a reason for hiding this comment

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

I see what you mean. I wasn't originally planning on changing the implementation of CsmObservability to use the plugin option, but I like that idea. I will be able to remove the internal API earlier. Will do that. Thanks!

Copy link
Member

@markdroth markdroth left a comment

Choose a reason for hiding this comment

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

Just a couple of lingering comments -- feel free to address or ignore.

/// grpc.server.call.started
/// grpc.server.call.duration
/// grpc.server.call.sent_total_compressed_message_size
/// grpc.server.call.rcvd_total_compressed_message_size
Copy link
Member

Choose a reason for hiding this comment

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

Probably no need to list the metrics in the comment now that the constants are in the header file directly.

Copy link
Member Author

Choose a reason for hiding this comment

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

done

absl::string_view OpenTelemetryTargetKey() { return "grpc.target"; }

namespace {
absl::flat_hash_set<std::string> BaseMetrics() {
Copy link
Member

Choose a reason for hiding this comment

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

Does this need to be std::string instead of absl::string_view?

Copy link
Member Author

Choose a reason for hiding this comment

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

I want to intentionally store the set as std::string instead of absl::string_view. The case I'm worried about is when in the future we allow users to provide the set of metric names that they want enabled and they provide non-constant strings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants