Skip to content
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

GAPIC-generated clients scribble on global DEFAULT_CLIENT_INFO #5710

Closed
tseaver opened this issue Jul 31, 2018 · 7 comments
Closed

GAPIC-generated clients scribble on global DEFAULT_CLIENT_INFO #5710

tseaver opened this issue Jul 31, 2018 · 7 comments
Assignees
Labels
api: automl Issues related to the AutoML API. api: bigquerydatatransfer Issues related to the BigQuery Data Transfer Service API. api: bigtable Issues related to the Bigtable API. api: clouderrorreporting Issues related to the Error Reporting API. api: cloudiot Issues related to the IoT Core API. api: cloudtasks Issues related to the Cloud Tasks API. api: cloudtrace Issues related to the Cloud Trace API. api: container Issues related to the Kubernetes Engine API API. api: dataproc Issues related to the Dataproc API. api: datastore Issues related to the Datastore API. api: dlp Issues related to the Sensitive Data Protection API. api: firestore Issues related to the Firestore API. api: language Issues related to the Cloud Natural Language API API. api: logging Issues related to the Cloud Logging API. api: monitoring Issues related to the Cloud Monitoring API. api: pubsub Issues related to the Pub/Sub API. api: redis Issues related to the Memorystore for Redis API. api: spanner Issues related to the Spanner API. api: speech Issues related to the Speech-to-Text API. api: texttospeech Issues related to the Text-to-Speech API. api: videointelligence Issues related to the Video Intelligence API API. api: vision Issues related to the Cloud Vision API. codegen priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@tseaver
Copy link
Contributor

tseaver commented Jul 31, 2018

tl;dr

The GAPIC-generated class constructors listed below scribble on the fallback google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO instance, rather than creating their own copy.

@crwilcox Can you please link in the related codegen issue?

Analysis

The pattern is that these client classes take an optional client_info parameter: if not passed, they use the DEFAULT_CLIENT_INFO instance. In either case, they then assign over its gapic_version attribute:

        if client_info is None:
            client_info = (
                google.api_core.gapic_v1.client_info.DEFAULT_CLIENT_INFO)
        client_info.gapic_version = _GAPIC_LIBRARY_VERSION
        self._client_info = client_info

I am certain that it is inappropriate to scribble on the global DEFAULT_CLIENT_INFO instance. Rather they should be creating a new google.api_core.gapic.client_info.ClientInfo instance. I
believe that if the user passes in a non-None client_info, these clients should not scribble on it. E.g.:

        if client_info is None:
            client_info = google.api_core.gapic_v1.client_info.ClientInfo(
                gapic_version = _GAPIC_LIBRARY_VERSION,
            )
        self._client_info = client_info

Offending Classes

  • google.cloud.automl_v1beta1.gapic.auto_ml_client.AutoMlClient
  • google.cloud.automl_v1beta1.gapic.prediction_service_client.PredictionServiceClient
  • google.cloud.bigquery_datatransfer_v1.gapic.data_transfer_service_client.DataTransferServiceClient
  • google.cloud.bigtable_admin_v2.gapic.bigtable_instance_admin_client.BigtableInstanceAdminClient
  • google.cloud.bigtable_admin_v2.gapic.bigtable_table_admin_client.BigtableTableAdminClient
  • google.cloud.bigtable_v2.gapic.bigtable_client.BigtableClient
  • google.cloud.container_v1.gapic.cluster_manager_client.ClusterManagerClient
  • google.cloud.dataproc_v1.gapic.cluster_controller_client.ClusterControllerClient
  • google.cloud.dataproc_v1.gapic.job_controller_client.JobControllerClient
  • google.cloud.datastore_v1.gapic.datastore_client.DatastoreClient
  • google.cloud.dlp_v2.gapic.dlp_service_client.DlpServiceClient
  • google.cloud.errorreporting_v1beta1.gapic.error_group_service_client.ErrorGroupServiceClient
  • google.cloud.errorreporting_v1beta1.gapic.error_stats_service_client.ErrorStatsServiceClient
  • google.cloud.errorreporting_v1beta1.gapic.report_errors_service_client.ReportErrorsServiceClient
  • google.cloud.firestore_v1beta1.gapic.firestore_client.FirestoreClient
  • google.cloud.iot_v1.gapic.device_manager_client.DeviceManagerClient
  • google.cloud.kms_v1.gapic.key_management_service_client.KeyManagementServiceClient
  • google.cloud.language_v1.gapic.language_service_client.LanguageServiceClient
  • google.cloud.language_v1beta2.gapic.language_service_client.LanguageServiceClient
  • google.cloud.logging_v2.gapic.config_service_v2_client.ConfigServiceV2Client
  • google.cloud.logging_v2.gapic.logging_service_v2_client.LoggingServiceV2Client
  • google.cloud.logging_v2.gapic.metrics_service_v2_client.MetricsServiceV2Client
  • google.cloud.monitoring_v3.gapic.alert_policy_service_client.AlertPolicyServiceClient
  • google.cloud.monitoring_v3.gapic.group_service_client.GroupServiceClient
  • google.cloud.monitoring_v3.gapic.metric_service_client.MetricServiceClient
  • google.cloud.monitoring_v3.gapic.notification_channel_service_client.NotificationChannelServiceClient
  • google.cloud.monitoring_v3.gapic.uptime_check_service_client.UptimeCheckServiceClient
  • google.cloud.oslogin_v1.gapic.os_login_service_client.OsLoginServiceClient
  • google.cloud.pubsub_v1.gapic.publisher_client.PublisherClient
  • google.cloud.pubsub_v1.gapic.subscriber_client.SubscriberClient
  • google.cloud.redis_v1beta1.gapic.cloud_redis_client.CloudRedisClient
  • google.cloud.spanner_admin_database_v1.gapic.database_admin_client.DatabaseAdminClient
  • google.cloud.spanner_admin_instance_v1.gapic.instance_admin_client.InstanceAdminClient
  • google.cloud.spanner_v1.gapic.spanner_client.SpannerClient
  • google.cloud.speech_v1.gapic.speech_client.SpeechClient
  • google.cloud.speech_v1p1beta1.gapic.speech_client.SpeechClient
  • google.cloud.tasks_v2beta2.gapic.cloud_tasks_client.CloudTasksClient
  • google.cloud.texttospeech_v1.gapic.text_to_speech_client.TextToSpeechClient
  • google.cloud.texttospeech_v1beta1.gapic.text_to_speech_client.TextToSpeechClient
  • google.cloud.trace_v1.gapic.trace_service_client.TraceServiceClient
  • google.cloud.trace_v2.gapic.trace_service_client.TraceServiceClient
  • google.cloud.videointelligence_v1.gapic.video_intelligence_service_client.VideoIntelligenceServiceClient
  • google.cloud.videointelligence_v1beta1.gapic.video_intelligence_service_client.VideoIntelligenceServiceClient
  • google.cloud.videointelligence_v1beta2.gapic.video_intelligence_service_client.VideoIntelligenceServiceClient
  • google.cloud.videointelligence_v1p1beta1.gapic.video_intelligence_service_client.VideoIntelligenceServiceClient
  • google.cloud.vision_v1.gapic.image_annotator_client.ImageAnnotatorClient
  • google.cloud.vision_v1p1beta1.gapic.image_annotator_client.ImageAnnotatorClient
  • google.cloud.vision_v1p2beta1.gapic.image_annotator_client.ImageAnnotatorClient
  • google.cloud.vision_v1p3beta1.gapic.image_annotator_client.ImageAnnotatorClient
  • google.cloud.vision_v1p3beta1.gapic.product_search_client.ProducSearchClient
  • google.cloud.websecurityscanner_v1alpha.gapic.web_security_scanner_client.WebSecurityScannerClient
@tseaver tseaver added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: datastore Issues related to the Datastore API. api: pubsub Issues related to the Pub/Sub API. api: bigtable Issues related to the Bigtable API. api: logging Issues related to the Cloud Logging API. api: vision Issues related to the Cloud Vision API. api: monitoring Issues related to the Cloud Monitoring API. api: speech Issues related to the Speech-to-Text API. api: spanner Issues related to the Spanner API. priority: p2 Moderately-important priority. Fix may not be included in next release. api: clouderrorreporting Issues related to the Error Reporting API. api: language Issues related to the Cloud Natural Language API API. api: cloudtrace Issues related to the Cloud Trace API. api: videointelligence Issues related to the Video Intelligence API API. api: firestore Issues related to the Firestore API. api: dataproc Issues related to the Dataproc API. api: container Issues related to the Kubernetes Engine API API. api: bigquerydatatransfer Issues related to the BigQuery Data Transfer Service API. api: dlp Issues related to the Sensitive Data Protection API. api: texttospeech Issues related to the Text-to-Speech API. api: redis Issues related to the Memorystore for Redis API. api: cloudiot Issues related to the IoT Core API. api: cloudtasks Issues related to the Cloud Tasks API. api: automl Issues related to the AutoML API. codegen labels Jul 31, 2018
@tseaver
Copy link
Contributor Author

tseaver commented Aug 8, 2018

Related gapic-generator bug.

@tseaver
Copy link
Contributor Author

tseaver commented Sep 18, 2018

Once googleapis/gapic-generator#2289 is merged / released, we can re-run synth to pick up the fix.

@tseaver
Copy link
Contributor Author

tseaver commented Oct 5, 2018

@theacodes Is there a reason to have this bug unassigned? @crwilcox was the one who reported the GAPIC generator bug.

@tseaver
Copy link
Contributor Author

tseaver commented Oct 30, 2018

googleapis/gapic-generator#2289 looks stalled / dead: it has conflicts, and nobody is responding to a ping.

@tseaver
Copy link
Contributor Author

tseaver commented Oct 31, 2018

W00t! the gapic-generator PR is merged as of today!

@theacodes I'm assuming we should see a bunch of autosynth PRs showing up from @dpebot as soon as the artman image is updated with the fix. Should we go ahead and close this issue, or maybe once they start showing up?

@theacodes
Copy link
Contributor

theacodes commented Oct 31, 2018 via email

@tseaver
Copy link
Contributor Author

tseaver commented Nov 6, 2018

Autosynth PRs with this fix have landed this morning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: automl Issues related to the AutoML API. api: bigquerydatatransfer Issues related to the BigQuery Data Transfer Service API. api: bigtable Issues related to the Bigtable API. api: clouderrorreporting Issues related to the Error Reporting API. api: cloudiot Issues related to the IoT Core API. api: cloudtasks Issues related to the Cloud Tasks API. api: cloudtrace Issues related to the Cloud Trace API. api: container Issues related to the Kubernetes Engine API API. api: dataproc Issues related to the Dataproc API. api: datastore Issues related to the Datastore API. api: dlp Issues related to the Sensitive Data Protection API. api: firestore Issues related to the Firestore API. api: language Issues related to the Cloud Natural Language API API. api: logging Issues related to the Cloud Logging API. api: monitoring Issues related to the Cloud Monitoring API. api: pubsub Issues related to the Pub/Sub API. api: redis Issues related to the Memorystore for Redis API. api: spanner Issues related to the Spanner API. api: speech Issues related to the Speech-to-Text API. api: texttospeech Issues related to the Text-to-Speech API. api: videointelligence Issues related to the Video Intelligence API API. api: vision Issues related to the Cloud Vision API. codegen priority: p2 Moderately-important priority. Fix may not be included in next release. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants