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 instrumentation for a couple of OpenTelemetry metrics #2501

Merged
merged 2 commits into from
May 28, 2024

Conversation

agrawal-siddharth
Copy link
Contributor

@agrawal-siddharth agrawal-siddharth commented May 14, 2024

Client application is responsible for initializing OpenTelemetry to consume these metrics. If OpenTelemetry is not initialized the metrics act as a no-op.

Copy link

conventional-commit-lint-gcf bot commented May 14, 2024

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@product-auto-label product-auto-label bot added size: m Pull request size is medium. api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. labels May 14, 2024
@agrawal-siddharth agrawal-siddharth changed the title Begin implementing couple OpenTelemetry metrics feat: Begin implementing couple OpenTelemetry metrics May 15, 2024
@agrawal-siddharth agrawal-siddharth changed the title feat: Begin implementing couple OpenTelemetry metrics feat: add instrumentation for a couple of OpenTelemetry metrics May 15, 2024
@yirutang yirutang requested a review from shollyman May 16, 2024 04:32
@agrawal-siddharth agrawal-siddharth force-pushed the openMetrics branch 3 times, most recently from 76dba99 to b504448 Compare May 17, 2024 04:21
@product-auto-label product-auto-label bot added size: l Pull request size is large. and removed size: m Pull request size is medium. labels May 25, 2024
Copy link
Contributor

@yirutang yirutang left a comment

Choose a reason for hiding this comment

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

LGTM only one comment.

if (this.traceId.toLowerCase().indexOf("dataflow:") >= 0) {
String[] traceIdParts = this.traceId.split(":", 8);
for (int i = 0; i < traceIdParts.length; i++) {
if (traceIdParts[i].toLowerCase().indexOf("dataflow") >= 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why we need a loop here? Can we remove L326 and just start with traceIdParts[0]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are cases where the "dataflow" value can appear in the first or the second part. Here are some examples of traceId values taken from actual logs:

Dataflow:2024-04-30_08_42_19-12633720189001946338
java-streamwriter:HEAD+20240508-1544 Dataflow:monorail-h-multi:2024-05-13_19_05_36-9076476533873711727:5306357987650008794
java-streamwriter Dataflow:pubsub-to-bq-staging-tongruil-1024-static:2024-05-14_15_13_14-5530509399715326669:7308531029326585036
java-streamwriter:HEAD+20240508-1544 Dataflow:monorail-c-multi:2024-05-08_11_44_34-6968230696879535523:2379627307761333914

Copy link
Contributor

Choose a reason for hiding this comment

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

O, I think I know why, the HEAD+20240508-1544 is supposed to be the version number but obviously it is a wrong value (could also be the head you look at are from head client libs).... How about do a pattern match of "XXXX Dataflow:" and put everything in the first custom metrics and process the followings with ":".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

@agrawal-siddharth agrawal-siddharth added the owlbot:run Add this label to trigger the Owlbot post processor. label May 28, 2024
@gcf-owl-bot gcf-owl-bot bot removed the owlbot:run Add this label to trigger the Owlbot post processor. label May 28, 2024
@agrawal-siddharth agrawal-siddharth merged commit 195ea96 into googleapis:main May 28, 2024
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquerystorage Issues related to the googleapis/java-bigquerystorage API. size: l Pull request size is large.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants