File tree Expand file tree Collapse file tree 3 files changed +26
-7
lines changed
Expand file tree Collapse file tree 3 files changed +26
-7
lines changed Original file line number Diff line number Diff line change @@ -57,4 +57,4 @@ def setup_executor(
5757 'ApiExecutionContext' ,
5858]
5959
60- __version__ = '0.2.2 '
60+ __version__ = '0.2.3 '
Original file line number Diff line number Diff line change 1- # Copyright 2025 Google LLC
1+ # Copyright 2026 Google LLC
22#
33# Licensed under the Apache License, Version 2.0 (the "License");
44# you may not use this file except in compliance with the License.
@@ -35,8 +35,23 @@ def initialize_tracer():
3535 tracer_provider = TracerProvider (resource = resource )
3636
3737 if otel_endpoint := os .getenv ('OTEL_EXPORTER_OTLP_ENDPOINT' ):
38- otlp_processor = BatchSpanProcessor (
39- OTLPSpanExporter (endpoint = otel_endpoint , insecure = True )
40- )
41- tracer_provider .add_span_processor (otlp_processor )
38+ if gcp_project_id := os .getenv ('OTEL_EXPORTER_GCP_PROJECT_ID' ):
39+ try :
40+ from opentelemetry .exporter .cloud_trace import CloudTraceSpanExporter
41+ except ImportError as e :
42+ raise ImportError (
43+ 'Please install garf_executors with GCP support '
44+ '- `pip install garf_executors[gcp]`'
45+ ) from e
46+
47+ cloud_span_processor = BatchSpanProcessor (
48+ CloudTraceSpanExporter (project_id = gcp_project_id )
49+ )
50+ tracer_provider .add_span_processor (cloud_span_processor )
51+ else :
52+ otlp_processor = BatchSpanProcessor (
53+ OTLPSpanExporter (endpoint = otel_endpoint , insecure = True )
54+ )
55+ tracer_provider .add_span_processor (otlp_processor )
56+
4257 trace .set_tracer_provider (tracer_provider )
Original file line number Diff line number Diff line change 4444 " garf-io[bq]" ,
4545 " pandas" ,
4646 " google-cloud-logging" ,
47+ " smart_open[gcs]" ,
4748]
4849sql =[
4950 " garf-io[sqlalchemy]" ,
5051 " pandas" ,
5152]
53+ gcp = [
54+ " opentelemetry-exporter-gcp-trace" ,
55+ ]
5256server =[
5357 " fastapi[standard]" ,
5458 " opentelemetry-instrumentation-fastapi" ,
5559 " typer" ,
5660]
5761all = [
58- " garf-executors[bq,sql,server]"
62+ " garf-executors[bq,sql,server,gcp ]"
5963]
6064[project .scripts ]
6165garf =" garf_executors.entrypoints.cli:main"
You can’t perform that action at this time.
0 commit comments