This repository was archived by the owner on Sep 17, 2025. It is now read-only.
Extract byte size from proto-plus messages#976
Merged
aabmass merged 3 commits intocensus-instrumentation:masterfrom Dec 8, 2020
Merged
Extract byte size from proto-plus messages#976aabmass merged 3 commits intocensus-instrumentation:masterfrom
aabmass merged 3 commits intocensus-instrumentation:masterfrom
Conversation
52dea6e to
41059c7
Compare
c31fc7d to
0dd0a98
Compare
0dd0a98 to
29339ce
Compare
lzchen
approved these changes
Dec 7, 2020
Member
Author
|
Just doing some testing on this before merging |
Member
Author
|
Did some manual testing, working as expected with proto-plus versions of a GCP client lib (used import time
from google.cloud.secretmanager_v1.types.service import (
AccessSecretVersionRequest,
)
from opencensus.trace.tracer import Tracer
from opencensus.trace.samplers import AlwaysOnSampler
from opencensus.trace import config_integration
from opencensus.ext.stackdriver.trace_exporter import StackdriverExporter
from opencensus.common.transports.async_ import AsyncTransport
from functools import partial
from google.cloud.secretmanager_v1.services.secret_manager_service import (
SecretManagerServiceClient,
)
config_integration.trace_integrations(["google_cloud_clientlibs"])
tracer = Tracer(
exporter=StackdriverExporter(transport=partial(AsyncTransport, wait_period=5.0)),
sampler=AlwaysOnSampler(),
)
def main() -> None:
secret_client = SecretManagerServiceClient()
secret = secret_client.access_secret_version(
AccessSecretVersionRequest(
name="projects/<projectid>/secrets/fake-secret/versions/1"
)
).payload.data.decode()
print("Got secret: {}".format(secret))
time.sleep(6)
if __name__ == "__main__":
main() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes #969
Recommendation for getting the byte size here: googleapis/proto-plus-python#163