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

impl(storage): helper class to generate invocation ids #9484

Merged
merged 2 commits into from
Jul 16, 2022

Conversation

coryan
Copy link
Contributor

@coryan coryan commented Jul 15, 2022

We will be adding telemetry to GCS requests, where all the retry
attempts for the same application call will share an "invocation id".
This will be included in the x-goog-api-client header, under the
gccl-invocation-id/ field. The design doc calls for a very specific
format for these ids, which this helper class generates.


This change is Reviewable

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Jul 15, 2022
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 4bdf6a448b66ad24c2ceda14eb809515fd1084fa

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@codecov
Copy link

codecov bot commented Jul 15, 2022

Codecov Report

Merging #9484 (ea427f1) into main (8f7f95b) will increase coverage by 0.00%.
The diff coverage is 98.36%.

@@           Coverage Diff           @@
##             main    #9484   +/-   ##
=======================================
  Coverage   94.62%   94.63%           
=======================================
  Files        1486     1488    +2     
  Lines      137065   137126   +61     
=======================================
+ Hits       129700   129767   +67     
+ Misses       7365     7359    -6     
Impacted Files Coverage Δ
google/cloud/storage/internal/retry_client.cc 100.00% <ø> (ø)
...d/storage/internal/invocation_id_generator_test.cc 97.29% <97.29%> (ø)
.../cloud/storage/internal/invocation_id_generator.cc 100.00% <100.00%> (ø)
...cloud/pubsub/internal/subscription_session_test.cc 97.98% <0.00%> (+0.16%) ⬆️
...le/cloud/internal/default_completion_queue_impl.cc 97.72% <0.00%> (+0.56%) ⬆️
...torage/examples/storage_service_account_samples.cc 97.64% <0.00%> (+1.17%) ⬆️
...bigtable/examples/bigtable_hello_instance_admin.cc 82.00% <0.00%> (+2.00%) ⬆️
...e/cloud/pubsublite/internal/alarm_registry_impl.cc 100.00% <0.00%> (+2.94%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8f7f95b...ea427f1. Read the comment docs.

@coryan coryan marked this pull request as ready for review July 15, 2022 15:12
@coryan coryan requested a review from a team as a code owner July 15, 2022 15:12
@coryan coryan added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 15, 2022
@coryan coryan enabled auto-merge (squash) July 15, 2022 20:13
@google-cloud-cpp-bot google-cloud-cpp-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 15, 2022
@coryan coryan added the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 16, 2022
@google-cloud-cpp-bot google-cloud-cpp-bot removed the kokoro:force-run Add this label to force Kokoro to re-run the tests. label Jul 16, 2022
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: 9b2b2e97f277edd4f13628e3187c75d91a5ee713

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

We will be adding telemetry to GCS requests, where all the retry
attempts for the same application call will share an "invocation id".
This will be included in the `x-goog-api-client` header, under the
`gccl-invocation-id/` field. The design doc calls for a very specific
format for these ids, which this helper class generates.
@coryan coryan force-pushed the impl-storage-retry-id-generator branch from 9b2b2e9 to b55ce90 Compare July 16, 2022 15:48
@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: b55ce907a4bca8fe6ce8d6e3c48801d2a8cdab21

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@google-cloud-cpp-bot
Copy link
Collaborator

Google Cloud Build Logs
For commit: ea427f1ca28b93eb47de5f8ed4e3e1a1fcdc1442

ℹ️ NOTE: Kokoro logs are linked from "Details" below.

@coryan coryan merged commit e47ba57 into googleapis:main Jul 16, 2022
@coryan coryan deleted the impl-storage-retry-id-generator branch July 18, 2022 12:14
auto constexpr kIdBitCount = 128;
auto constexpr kArraySize = kIdBitCount / 8;
std::array<std::uint8_t, kArraySize> buf;
std::uniform_int_distribution<std::uint8_t> d(0, 255);
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm seeing a static assertion failure with a platform of interest.

    static_assert(__libcpp_random_is_valid_inttype<_IntType>::value, "IntType must be an integer type larger than char");

Copy link
Contributor

Choose a reason for hiding this comment

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

For what it's worth, cppreference says ...
"IntType - The result type generated by the generator. The effect is undefined if this is not one of short, int, long, long long, unsigned short, unsigned int, unsigned long, or unsigned long long."

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Blegh. Okay, we can use int and cast to the desired result. The output should be in range. I can send a PR, but I need to dig myself from all the upgrade PRs that are breaking things right now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

See #9509. Let's see what the builds say.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: storage Issues related to the Cloud Storage API.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants