Skip to content

add zone to GAE Flex logging enhancer#1589

Merged
garrettjonesgoogle merged 11 commits intogoogleapis:masterfrom
jetty-project:enhance-zone
Feb 9, 2017
Merged

add zone to GAE Flex logging enhancer#1589
garrettjonesgoogle merged 11 commits intogoogleapis:masterfrom
jetty-project:enhance-zone

Conversation

@gregw
Copy link
Copy Markdown

@gregw gregw commented Feb 3, 2017

The google stackdriver logging console requires that the zone label be set in the monitored resource before it can aggregate logs by trace ID.

@googlebot googlebot added the cla: yes This human has signed the Contributor License Agreement. label Feb 3, 2017
@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.04%) to 83.31% when pulling b7c062f on jetty-project:enhance-zone into 2fbb281 on GoogleCloudPlatform:master.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.03%) to 83.315% when pulling b7c062f on jetty-project:enhance-zone into 2fbb281 on GoogleCloudPlatform:master.

@meltsufin
Copy link
Copy Markdown
Member

@garrettjonesgoogle Can you please take a look?

@garrettjonesgoogle
Copy link
Copy Markdown
Contributor

There is a release going out on Tuesday that I don't want to destabilize; I'll take a look after that goes out.

Copy link
Copy Markdown
Contributor

@garrettjonesgoogle garrettjonesgoogle left a comment

Choose a reason for hiding this comment

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

BTW, someone pointed out that LoggingHandler.Enhancer is package-private. Could you make it public in this PR?

try {
HttpURLConnection metadata = (HttpURLConnection) new URL(
"http://metadata.google.internal/computeMetadata/v1/instance/zone").openConnection();
metadata.setRequestProperty("Metadata-Flavor", "Google");

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

gregw added 4 commits February 9, 2017 10:44
Handler initialization may now call user supplied code in enhancers during
initialization and logging.  This commit catches any exceptions thrown and
uses the existing error reporting mechanism to log the exception the stderr.

The GaeFlexEnhancer now separately logs any exception when obtaining the zone,
but does not throw it as having the zone is only optional and should be non
fatal to the logger.
@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 881e75f on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling b661c62 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@coveralls
Copy link
Copy Markdown

Coverage Status

Changes Unknown when pulling 744ca64 on jetty-project:enhance-zone into ** on GoogleCloudPlatform:master**.

@meltsufin
Copy link
Copy Markdown
Member

@garrettjonesgoogle Would this make into the next release, and when is it scheduled to go out?

MonitoredResource resource = monitoredResource != null ? monitoredResource : getDefaultResource(resourceType);
writeOptions = new WriteOption[]{WriteOption.logName(logName), WriteOption.resource(resource)};
}
catch (Exception ex) {

This comment was marked as spam.

try {
HttpURLConnection metadata = (HttpURLConnection) new URL(
"http://metadata.google.internal/computeMetadata/v1/instance/zone").openConnection();
metadata.setRequestProperty("Metadata-Flavor", "Google");

This comment was marked as spam.

@garrettjonesgoogle
Copy link
Copy Markdown
Contributor

This should make it into the next release. I'm intending on doing a release tomorrow (Friday).

@gregw
Copy link
Copy Markdown
Author

gregw commented Feb 9, 2017

@garrettjonesgoogle I have fixed those issues. Note the unit tests are not passing, but neither are they in master (for me). I'll try to investigate later today.

@garrettjonesgoogle
Copy link
Copy Markdown
Contributor

LGTM - once you figure out the tests I will merge it.

@coveralls
Copy link
Copy Markdown

Coverage Status

Coverage decreased (-0.07%) to 83.382% when pulling b6100dd on jetty-project:enhance-zone into fa0720c on GoogleCloudPlatform:master.

@garrettjonesgoogle garrettjonesgoogle merged commit c04d163 into googleapis:master Feb 9, 2017
@gregw gregw deleted the enhance-zone branch February 12, 2017 21:56
chingor13 pushed a commit that referenced this pull request Jan 22, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chingor13 pushed a commit that referenced this pull request Jan 27, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
chingor13 pushed a commit that referenced this pull request Feb 24, 2026
* fix: JSON parsing of S2A addresses.

* extract extra parsing logic to calling method.

* cast once + use defined constant.
chingor13 pushed a commit that referenced this pull request Mar 12, 2026
* fix: JSON parsing of S2A addresses.

* extract extra parsing logic to calling method.

* cast once + use defined constant.
lqiu96 pushed a commit that referenced this pull request Mar 20, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
suztomo pushed a commit to suztomo/google-cloud-java that referenced this pull request Mar 23, 2026
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
lqiu96 pushed a commit that referenced this pull request Apr 1, 2026
meltsufin pushed a commit that referenced this pull request Apr 29, 2026
meltsufin pushed a commit that referenced this pull request May 1, 2026
meltsufin pushed a commit that referenced this pull request May 2, 2026
* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions. (#1531)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* Address code review feedback.

* feat: Add com.google.cloud.firestore.telemetry package. (#1533)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* feat: Add com.google.cloud.firestore.telemetry package.

* Address code review feedback.

* Factor out the otel version in pom.xml.

* fix: Remove OpenCensus tracing code. (#1589)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* feat: Add com.google.cloud.firestore.telemetry package.

* fix: Remove OpenCensus tracing code.

* feat: tracing for aggregate queries, bulkwriter, partition queries, a… (#1590)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* feat: Add com.google.cloud.firestore.telemetry package.

* fix: Remove OpenCensus tracing code.

* feat: tracing for aggregate queries, bulkwriter, partition queries, and listDocuments.

* Address code review feedback.

* Address feedback.

* don't use wildcard imports.

* feat: trace instrumentation for DocumentReference methods. (#1591)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* feat: Add com.google.cloud.firestore.telemetry package.

* fix: Remove OpenCensus tracing code.

* feat: tracing for aggregate queries, bulkwriter, partition queries, and listDocuments.

* feat: trace instrumentation for DocumentReference methods.

* feat: trace instrumentation for queries and transactions. (#1592)

* feat: Add FirestoreOpenTelemetryOptions to FirestoreOptions.

* feat: Add com.google.cloud.firestore.telemetry package.

* fix: Remove OpenCensus tracing code.

* feat: tracing for aggregate queries, bulkwriter, partition queries, and listDocuments.

* feat: trace instrumentation for DocumentReference methods.

* feat: trace instrumentation for queries and transactions.

* test: Adding first e2e client-tracing test w/ Custom Root Span (#1621)

* test: Adding first e2e client-tracing test w/ Custom Root Span

* Roll back E2E tests commit.

* Address feedback.

* Address feedback (better event log message).

* Address feedback.

---------

Co-authored-by: Jimit J Shah <57637300+jimit-j-shah@users.noreply.github.com>

* test: End-to-End Integration Test for Client-side Tracing in Firestore Java Server SDK using OpenTelemetry SDK and Cloud Trace Exporter against Cloud Trace. (#1635)

* Adding first e2e client-tracing test w/ Custom Root Span

* test: Adding first e2e client-tracing test w/ Custom Root Span

* Fixing test dependencies and use default GCP testing project.

Fixing

* Fixing test dependencies and use default GCP testing project.

* Fixing formatting

* Add aggregationQueryGet Test

* Add bulkWriterCommitTrace Test

* Fixing running multiple-tests

* Add partitionQuery Test

* Add collectionListDocumentsTrace Test

* Add docRef*Trace Tests

* Add docRefUpdate*Trace and docRefDelete*Trace Tests

* Fixing Trace fetching using retries for missing or incomplete traces due to eventual consistency of Cloud Trace

* Add get/query Trace Tests

* Add Transaction test

* Added TraceContainer to be able to test transaction test-cases

* test: Adding Transaction tests

* test: Adding Transaction tests

* test: Adding TestParameterInjector to run the test for global and non-global opentelemetry SDK instances

* test: formatting and cleanup

* test: Adding first e2e client-tracing test w/ Custom Root Span

* test: Add aggregationQueryGet Test

* test: Add bulkWriterCommitTrace Test and fixed running multiple-tests

* test: Add partitionQuery Test

* test: Add collectionListDocumentsTrace Test

* test: Add docRefUpdate*Trace and docRefDelete*Trace Tests and fixed Trace fetching using retries for missing or incomplete traces due to eventual consistency of Cloud Trace

* test: Add get/query Trace Tests

* test: Added Transaction tests using TraceContainer to verify traces for Transaction ops (BeginTransaction, Rollback etc)

* test: Adding TestParameterInjector to run the test for global and non-global opentelemetry SDK instances

* test: Formatting and cleanup

* test: review comments

* test: fixing dfs to handle case where the compareTo callstack may be shorter than the trace callstack - don't need to throw an exception in that case

* test: Consolidating verification methods

* test: review comments

* fix: Make telemetry-related fields transient. (#1638)

* fix: Rename 'enabled' to 'tracingEnabled'. (#1639)

* fix: Rename 'enabled' to 'tracingEnabled'.

In the future, FirestoreOpenTelemetryOptions will support enabling/disabling
Logging and Metrics as well. So we should use a better name for this field.

* address feedback.

* fix: Minor improvement to the ITE2ETracingTest. (#1637)

* fix: Minor improvement to the ITE2ETracingTest.

* revert the numExpectedSpans change.

* feat: Add 'isTransactional' attribute. (#1657)

* fix: Necessary test improvements for CI environments. (#1673)

* fix: Necessary test improvements for CI environments.

* Address feedback.

* feat: Disable the tracing feature and remove public APIs.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Add the Firestore SDK version to the attributes.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Update the "test" dependency versions.

* Address feedback related to attributes.

* Add 'project_id' attribute.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

* Revert a736fcc ("Disable the tracing feature and remove public APIs").

* GlobalOtel reset for test must happen in `before`, not `after`.

* Address feedback.

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

---------

Co-authored-by: Jimit J Shah <57637300+jimit-j-shah@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants