Skip to content

Commit b92e05e

Browse files
[executors] feat: make init of telemetry optional
* Emit telemetry data only if there's OTEL_EXPORTER_OTLP_ENDPOINT * Add tracer initialization into a CLI entrypoint
1 parent 1b7409a commit b92e05e

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

libs/executors/garf_executors/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,4 +50,4 @@ def setup_executor(
5050
'ApiExecutionContext',
5151
]
5252

53-
__version__ = '0.1.0'
53+
__version__ = '0.1.1'

libs/executors/garf_executors/entrypoints/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@
2727

2828
import garf_executors
2929
from garf_executors import config, exceptions
30-
from garf_executors.entrypoints import utils
30+
from garf_executors.entrypoints import tracer, utils
31+
32+
tracer.initialize_tracer()
3133

3234

3335
def main():

libs/executors/garf_executors/entrypoints/tracer.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@ def initialize_tracer():
3434

3535
tracer_provider = TracerProvider(resource=resource)
3636

37-
otlp_processor = BatchSpanProcessor(
38-
OTLPSpanExporter(
39-
endpoint=os.getenv('OTEL_EXPORTER_OTLP_ENDPOINT'), insecure=True
37+
if otel_endpoint := os.getenv('OTEL_EXPORTER_OTLP_ENDPOINT'):
38+
otlp_processor = BatchSpanProcessor(
39+
OTLPSpanExporter(endpoint=otel_endpoint, insecure=True)
4040
)
41-
)
42-
tracer_provider.add_span_processor(otlp_processor)
43-
41+
tracer_provider.add_span_processor(otlp_processor)
4442
trace.set_tracer_provider(tracer_provider)

0 commit comments

Comments
 (0)