-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
chore(logging): add detectResource benchmark #6084
Merged
minherz
merged 1 commit into
structured_logging
from
minherz/add-detect-resource-benchmark
May 24, 2022
Merged
chore(logging): add detectResource benchmark #6084
minherz
merged 1 commit into
structured_logging
from
minherz/add-detect-resource-benchmark
May 24, 2022
Conversation
This file contains 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
product-auto-label
bot
added
size: s
Pull request size is small.
api: logging
Issues related to the Cloud Logging API.
labels
May 24, 2022
minherz
added a commit
that referenced
this pull request
May 24, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
minherz
added a commit
that referenced
this pull request
May 25, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
minherz
added a commit
that referenced
this pull request
May 28, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
minherz
added a commit
that referenced
this pull request
Jun 10, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
minherz
added a commit
that referenced
this pull request
Jun 23, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
minherz
added a commit
that referenced
this pull request
Jun 25, 2022
Adding a benchmark test to measure execution time for detectResource() to address #5855. Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger. The benchmark demonstrates that only first Logger takes long time: ```bash go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s ``` When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Adding a benchmark test to measure execution time for detectResource() to address #5855.
Current implementation uses cloud.google.com/go/compute/metadata package to read Google Cloud metadata server attributes. The package implements retrying mechanism to cover on occasional problems of miscommunication with the metadata server. When a new Logger instance is being created, it calls detectResource() to read the monitored resource object. The resource detection algorithm is invoked once per process (regardless of how many Logger instances is created). The algorithm checks whether the environment runs the metadata server as a first step and to avoid further validations. Due to the retrying mechanism, this call may take between 6 to 7 seconds which composes the overall delay of creating a first instance of the Logger.
The benchmark demonstrates that only first Logger takes long time:
go test -run=XXX -bench=BenchmarkDetectResource -benchtime 8s goos: linux goarch: amd64 pkg: cloud.google.com/go/logging cpu: 11th Gen Intel(R) Core(TM) i7-1185G7 @ 3.00GHz BenchmarkDetectResource-8 1000000000 2.291 ns/op PASS ok cloud.google.com/go/logging 9.955s
When the cloud.google.com/go/compute/metadata package will be modified to allow customizable retrying mechanism, this logic will be altered to minimize the number of retries for the initial call.