GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Running driver outside GCP leads to a potentially very long initialisation due to internal calls to an internal GCP URL · Issue #2250 · googleapis/java-spanner-jdbc

This repository was archived by the owner on Sep 30, 2026. It is now read-only.
This repository was archived by the owner on Sep 30, 2026. It is now read-only.

Running driver outside GCP leads to a potentially very long initialisation due to internal calls to an internal GCP URL #2250

Copy link
Copy link
Closed
googleapis/java-spanner
#4163
googleapis/java-spanner#4163
Closed
Running driver outside GCP leads to a potentially very long initialisation due to internal calls to an internal GCP URL#2250
googleapis/java-spanner
#4163
Copy link
Assignees
olavloite
Labels
api: spannerIssues related to the googleapis/java-spanner-jdbc API.

Description

@jartur
jartur
opened on Oct 10, 2025
Issue body actions

There's an issue with Spanner JDBC driver when run locally (outside of GCP). It boils down to how during connection initialisation it tries to determine whether it's running inside GCP, using an http request to metadata.google.internal which, at least on macOS takes up to 150 seconds to fail, and since this is a blocking call it means that any connection can take that long to be established. This makes it impossible to use the newer versions of the driver (newer than 2.26.1) for local development.

The function in question is com.google.cloud.opentelemetry.detection.GCPPlatformDetector#isRunningOnGcp

Here are two rough paths I found that lead to that function called during initialisation, one of them can be turned off by disabling grpc metrics, but the other one is not possible to override.

com.google.cloud.opentelemetry.detection.GCPPlatformDetector#isRunningOnGcp
com.google.cloud.spanner.BuiltInMetricsProvider#createResourceAttributes 
com.google.cloud.spanner.BuiltInMetricsProvider#getOrCreateOpenTelemetry 
com.google.cloud.spanner.BuiltInMetricsProvider#enableGrpcMetrics 

builder.put(CLOUD_REGION_KEY, BuiltInMetricsProvider.detectClientLocation()); 
com.google.cloud.spanner.TraceWrapper#createCommonAttributes
com.google.cloud.spanner.SessionClient#SessionClient 

Activity

  1. product-auto-label
    added
    api: spannerIssues related to the googleapis/java-spanner-jdbc API.
    on Oct 10, 2025
  2. blunderbuss-gcf
    assigned
    olavloite
    on Oct 10, 2025
  3. olavloite commented on Oct 10, 2025

    @olavloite
    olavloite
    on Oct 10, 2025
    Contributor
    More actions

    cc @sakthivelmanii @surbhigarg92 This issue is not directly related to the JDBC driver, but could happen to anyone using the Spanner Java client.

  4. olavloite commented on Oct 10, 2025

    @olavloite
    olavloite
    on Oct 10, 2025
    Contributor
    More actions

    @jartur One workaround is to set the following two environment variables:

    SPANNER_DISABLE_BUILTIN_METRICS=true
    SPANNER_DISABLE_DIRECT_ACCESS_GRPC_BUILTIN_METRICS=true
    
  5. olavloite
    added a commit that references this issue on Oct 10, 2025

    fix: do a quick check if the application runs on GCP

    29240b1
  6. surbhigarg92
    closed this as completedin java-spanner#4163on Oct 13, 2025
  7. surbhigarg92
    added a commit that references this issue on Oct 13, 2025

    fix: do a quick check if the application runs on GCP (#4163)

    b9d7daf
  8. chingor13
    added a commit that references this issue on Mar 24, 2026

    fix: do a quick check if the application runs on GCP (#4163)

    12bc4dd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @olavloite
    olavloite

Labels

api: spannerIssues related to the googleapis/java-spanner-jdbc API.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.