-
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
feat(logging): implement auto-population of the calling source location #6043
Merged
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
@codyoss can you have a look into the test implementation? maybe you will have a good idea how i can test it without patching the wanted result |
minherz
force-pushed
the
structured_logging
branch
from
May 18, 2022 20:27
21efdb3
to
b7bf803
Compare
add implicit source location population for ingested log entries that have severity level DEBUG
add unit testing for source location add function name to the published source info
minherz
force-pushed
the
minherz/source-location
branch
from
May 18, 2022 20:27
7cd80b0
to
67e82e0
Compare
add logger option to control source location population
minherz
changed the title
feat(logging) implement auto-population of the calling source location
feat(logging): implement auto-population of the calling source location
May 20, 2022
minherz
added a commit
that referenced
this pull request
May 20, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
May 24, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
May 25, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
May 28, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
Jun 10, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
Jun 23, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
Jun 25, 2022
…on (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries
minherz
added a commit
that referenced
this pull request
Jun 25, 2022
* fix(logging): revise automatic resource detection for ingested logs (#6022) align resource detection with heuristics in logging libraries for other languages: - use /sys/class/dmi/id/product_name to read a product name of the resource on Linux - change resource detection heuristics in a way that the order of validation is not important - reduce timeout and retrying logic when querying metadata server - demand active metadata server for detecting GCP resources (for GCE, GAE, GKE, CR and CF) - add test to validate resource detection heuristics * feat(logging): implement auto-population of the calling source location (#6043) add source location population for ingested log entries. provide designated logger option: `SourceLocationPopulation` to control source population logic. The option can be initiated with the following values: * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - continue with existing behavior when the source location field of the log entry is not populated automatically (default) * `SourceLocationPopulation(PopulateSourceLocationForDebugEntries)` - the source location is auto-populated for log entries with Debug severity * `SourceLocationPopulation(DoNotPopulateSourceLocation)` - the source location is auto-populated for all log entries Add a benchmark test to measure execution time for detectResource() to help with addressing issues like #5855. ```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. * feat(logging): support partialSuccess flag for batched ingestions (#6092) Add PartialSuccess option to set partialSuccess flag in WriteLogEntries calls to true * feat(logging): retrieve trace info from traceparent (#6101) Add support for W3C trace context header: traceparent * feat(logging): enable redirecting log ingestion to stdout/stderr (#6130) Implement writing log entries to io.writer instead of ingesting them to Logging service. the written log entries are Jsonified into one line strings following structured logging format. Support protobuf payloads when passing the payload as protobuf.Any.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
auto-populate the ingest log entry with the source location of the calling code including file name, function name and code line number.
provide designated logger option:
SourceLocationPopulation
to control source population logic. The option can be initiated with the following values:SourceLocationPopulation(DoNotPopulateSourceLocation)
- continue with existing behavior when the source location field of the log entry is not populated automatically (default)SourceLocationPopulation(PopulateSourceLocationForDebugEntries)
- the source location is auto-populated for log entries with Debug severitySourceLocationPopulation(DoNotPopulateSourceLocation)
- the source location is auto-populated for all log entries