garf-executors 0.0.13__tar.gz → 0.1.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {garf_executors-0.0.13 → garf_executors-0.1.2}/PKG-INFO +5 -1
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/__init__.py +3 -1
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/api_executor.py +10 -1
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/bq_executor.py +3 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/entrypoints/cli.py +8 -3
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/entrypoints/server.py +19 -7
- garf_executors-0.1.2/garf_executors/entrypoints/tracer.py +42 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/executor.py +30 -15
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/fetchers.py +10 -3
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/sql_executor.py +5 -0
- garf_executors-0.1.2/garf_executors/telemetry.py +20 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/PKG-INFO +5 -1
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/SOURCES.txt +2 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/requires.txt +4 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/pyproject.toml +4 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/README.md +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/config.py +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/entrypoints/__init__.py +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/entrypoints/utils.py +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/exceptions.py +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors/execution_context.py +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/dependency_links.txt +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/entry_points.txt +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/garf_executors.egg-info/top_level.txt +0 -0
- {garf_executors-0.0.13 → garf_executors-0.1.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: garf-executors
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Executes queries against API and writes data to local/remote storage.
|
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>, Andrei Markin <andrey.markin.ppc@gmail.com>
|
|
6
6
|
License: Apache 2.0
|
|
@@ -21,6 +21,8 @@ Requires-Dist: garf-core
|
|
|
21
21
|
Requires-Dist: garf-io
|
|
22
22
|
Requires-Dist: pyyaml
|
|
23
23
|
Requires-Dist: pydantic
|
|
24
|
+
Requires-Dist: opentelemetry-api
|
|
25
|
+
Requires-Dist: opentelemetry-sdk
|
|
24
26
|
Provides-Extra: bq
|
|
25
27
|
Requires-Dist: garf-io[bq]; extra == "bq"
|
|
26
28
|
Requires-Dist: pandas; extra == "bq"
|
|
@@ -30,6 +32,8 @@ Requires-Dist: garf-io[sqlalchemy]; extra == "sql"
|
|
|
30
32
|
Requires-Dist: pandas; extra == "sql"
|
|
31
33
|
Provides-Extra: server
|
|
32
34
|
Requires-Dist: fastapi[standard]; extra == "server"
|
|
35
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi; extra == "server"
|
|
36
|
+
Requires-Dist: opentelemetry-exporter-otlp; extra == "server"
|
|
33
37
|
Provides-Extra: all
|
|
34
38
|
Requires-Dist: garf-executors[bq,server,sql]; extra == "all"
|
|
35
39
|
|
|
@@ -19,8 +19,10 @@ import importlib
|
|
|
19
19
|
|
|
20
20
|
from garf_executors import executor, fetchers
|
|
21
21
|
from garf_executors.api_executor import ApiExecutionContext, ApiQueryExecutor
|
|
22
|
+
from garf_executors.telemetry import tracer
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
@tracer.start_as_current_span('setup_executor')
|
|
24
26
|
def setup_executor(
|
|
25
27
|
source: str, fetcher_parameters: dict[str, str]
|
|
26
28
|
) -> type[executor.Executor]:
|
|
@@ -48,4 +50,4 @@ __all__ = [
|
|
|
48
50
|
'ApiExecutionContext',
|
|
49
51
|
]
|
|
50
52
|
|
|
51
|
-
__version__ = '0.
|
|
53
|
+
__version__ = '0.1.2'
|
|
@@ -20,11 +20,14 @@ GarfReport and saving it to local/remote storage.
|
|
|
20
20
|
|
|
21
21
|
from __future__ import annotations
|
|
22
22
|
|
|
23
|
+
import asyncio
|
|
23
24
|
import logging
|
|
24
25
|
|
|
25
26
|
from garf_core import report_fetcher
|
|
27
|
+
from opentelemetry import trace
|
|
26
28
|
|
|
27
29
|
from garf_executors import exceptions, execution_context, executor, fetchers
|
|
30
|
+
from garf_executors.telemetry import tracer
|
|
28
31
|
|
|
29
32
|
logger = logging.getLogger(__name__)
|
|
30
33
|
|
|
@@ -75,8 +78,9 @@ class ApiQueryExecutor(executor.Executor):
|
|
|
75
78
|
Returns:
|
|
76
79
|
Result of writing the report.
|
|
77
80
|
"""
|
|
78
|
-
return await self.execute
|
|
81
|
+
return await asyncio.to_thread(self.execute, query, title, context)
|
|
79
82
|
|
|
83
|
+
@tracer.start_as_current_span('api.execute')
|
|
80
84
|
def execute(
|
|
81
85
|
self,
|
|
82
86
|
query: str,
|
|
@@ -96,7 +100,12 @@ class ApiQueryExecutor(executor.Executor):
|
|
|
96
100
|
Raises:
|
|
97
101
|
GarfExecutorError: When failed to execute query.
|
|
98
102
|
"""
|
|
103
|
+
span = trace.get_current_span()
|
|
104
|
+
span.set_attribute('fetcher', self.fetcher.__class__.__name__)
|
|
105
|
+
span.set_attribute('api_client', self.fetcher.api_client.__class__.__name__)
|
|
99
106
|
try:
|
|
107
|
+
span.set_attribute('query_title', title)
|
|
108
|
+
span.set_attribute('query_text', query)
|
|
100
109
|
logger.debug('starting query %s', query)
|
|
101
110
|
results = self.fetcher.fetch(
|
|
102
111
|
query_specification=query,
|
|
@@ -31,6 +31,7 @@ from garf_core import query_editor, report
|
|
|
31
31
|
from google.cloud import exceptions as google_cloud_exceptions
|
|
32
32
|
|
|
33
33
|
from garf_executors import exceptions, execution_context, executor
|
|
34
|
+
from garf_executors.telemetry import tracer
|
|
34
35
|
|
|
35
36
|
logger = logging.getLogger(__name__)
|
|
36
37
|
|
|
@@ -72,6 +73,7 @@ class BigQueryExecutor(executor.Executor, query_editor.TemplateProcessorMixin):
|
|
|
72
73
|
"""Instantiates bigquery client."""
|
|
73
74
|
return bigquery.Client(self.project_id)
|
|
74
75
|
|
|
76
|
+
@tracer.start_as_current_span('bq.execute')
|
|
75
77
|
def execute(
|
|
76
78
|
self,
|
|
77
79
|
query: str,
|
|
@@ -119,6 +121,7 @@ class BigQueryExecutor(executor.Executor, query_editor.TemplateProcessorMixin):
|
|
|
119
121
|
except google_cloud_exceptions.GoogleCloudError as e:
|
|
120
122
|
raise BigQueryExecutorError(e) from e
|
|
121
123
|
|
|
124
|
+
@tracer.start_as_current_span('bq.create_datasets')
|
|
122
125
|
def create_datasets(self, macros: dict | None) -> None:
|
|
123
126
|
"""Creates datasets in BQ based on values in a dict.
|
|
124
127
|
|
|
@@ -28,8 +28,13 @@ from garf_io import reader
|
|
|
28
28
|
import garf_executors
|
|
29
29
|
from garf_executors import config, exceptions
|
|
30
30
|
from garf_executors.entrypoints import utils
|
|
31
|
+
from garf_executors.entrypoints.tracer import initialize_tracer
|
|
32
|
+
from garf_executors.telemetry import tracer
|
|
31
33
|
|
|
34
|
+
initialize_tracer()
|
|
32
35
|
|
|
36
|
+
|
|
37
|
+
@tracer.start_as_current_span('garf.entrypoints.cli')
|
|
33
38
|
def main():
|
|
34
39
|
parser = argparse.ArgumentParser()
|
|
35
40
|
parser.add_argument('query', nargs='*')
|
|
@@ -49,7 +54,7 @@ def main():
|
|
|
49
54
|
parser.add_argument('--dry-run', dest='dry_run', action='store_true')
|
|
50
55
|
parser.add_argument('-v', '--version', dest='version', action='store_true')
|
|
51
56
|
parser.add_argument(
|
|
52
|
-
'--parallel-threshold', dest='parallel_threshold', default=
|
|
57
|
+
'--parallel-threshold', dest='parallel_threshold', default=10, type=int
|
|
53
58
|
)
|
|
54
59
|
parser.set_defaults(parallel_queries=True)
|
|
55
60
|
parser.set_defaults(dry_run=False)
|
|
@@ -77,7 +82,7 @@ def main():
|
|
|
77
82
|
args.source, context.fetcher_parameters
|
|
78
83
|
)
|
|
79
84
|
batch = {query: reader_client.read(query) for query in args.query}
|
|
80
|
-
query_executor.execute_batch(batch, context, args.
|
|
85
|
+
query_executor.execute_batch(batch, context, args.parallel_threshold)
|
|
81
86
|
else:
|
|
82
87
|
extra_parameters = utils.ParamsParser(
|
|
83
88
|
['source', args.output, 'macro', 'template']
|
|
@@ -99,7 +104,7 @@ def main():
|
|
|
99
104
|
if args.parallel_queries:
|
|
100
105
|
logger.info('Running queries in parallel')
|
|
101
106
|
batch = {query: reader_client.read(query) for query in args.query}
|
|
102
|
-
query_executor.execute_batch(batch, context, args.
|
|
107
|
+
query_executor.execute_batch(batch, context, args.parallel_threshold)
|
|
103
108
|
else:
|
|
104
109
|
logger.info('Running queries sequentially')
|
|
105
110
|
for query in args.query:
|
|
@@ -20,9 +20,15 @@ import fastapi
|
|
|
20
20
|
import pydantic
|
|
21
21
|
import uvicorn
|
|
22
22
|
from garf_io import reader
|
|
23
|
+
from opentelemetry.instrumentation.fastapi import FastAPIInstrumentor
|
|
23
24
|
|
|
24
25
|
import garf_executors
|
|
25
26
|
from garf_executors import exceptions
|
|
27
|
+
from garf_executors.entrypoints.tracer import initialize_tracer
|
|
28
|
+
|
|
29
|
+
initialize_tracer()
|
|
30
|
+
app = fastapi.FastAPI()
|
|
31
|
+
FastAPIInstrumentor.instrument_app(app)
|
|
26
32
|
|
|
27
33
|
|
|
28
34
|
class ApiExecutorRequest(pydantic.BaseModel):
|
|
@@ -40,7 +46,7 @@ class ApiExecutorRequest(pydantic.BaseModel):
|
|
|
40
46
|
title: Optional[str] = None
|
|
41
47
|
query: Optional[str] = None
|
|
42
48
|
query_path: Optional[Union[str, list[str]]] = None
|
|
43
|
-
context: garf_executors.ApiExecutionContext
|
|
49
|
+
context: garf_executors.api_executor.ApiExecutionContext
|
|
44
50
|
|
|
45
51
|
@pydantic.model_validator(mode='after')
|
|
46
52
|
def check_query_specified(self):
|
|
@@ -67,10 +73,18 @@ class ApiExecutorResponse(pydantic.BaseModel):
|
|
|
67
73
|
results: list[str]
|
|
68
74
|
|
|
69
75
|
|
|
70
|
-
|
|
76
|
+
@app.get('/api/version')
|
|
77
|
+
async def version() -> str:
|
|
78
|
+
return garf_executors.__version__
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
@app.get('/api/fetchers')
|
|
82
|
+
async def get_fetchers() -> list[str]:
|
|
83
|
+
"""Shows all available API sources."""
|
|
84
|
+
return list(garf_executors.fetchers.find_fetchers())
|
|
71
85
|
|
|
72
86
|
|
|
73
|
-
@
|
|
87
|
+
@app.post('/api/execute')
|
|
74
88
|
async def execute(request: ApiExecutorRequest) -> ApiExecutorResponse:
|
|
75
89
|
query_executor = garf_executors.setup_executor(
|
|
76
90
|
request.source, request.context.fetcher_parameters
|
|
@@ -79,8 +93,8 @@ async def execute(request: ApiExecutorRequest) -> ApiExecutorResponse:
|
|
|
79
93
|
return ApiExecutorResponse(results=[result])
|
|
80
94
|
|
|
81
95
|
|
|
82
|
-
@
|
|
83
|
-
|
|
96
|
+
@app.post('/api/execute:batch')
|
|
97
|
+
def execute_batch(request: ApiExecutorRequest) -> ApiExecutorResponse:
|
|
84
98
|
query_executor = garf_executors.setup_executor(
|
|
85
99
|
request.source, request.context.fetcher_parameters
|
|
86
100
|
)
|
|
@@ -91,6 +105,4 @@ async def execute_batch(request: ApiExecutorRequest) -> ApiExecutorResponse:
|
|
|
91
105
|
|
|
92
106
|
|
|
93
107
|
if __name__ == '__main__':
|
|
94
|
-
app = fastapi.FastAPI()
|
|
95
|
-
app.include_router(router)
|
|
96
108
|
uvicorn.run(app)
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
|
|
17
|
+
from opentelemetry import trace
|
|
18
|
+
from opentelemetry.exporter.otlp.proto.grpc.trace_exporter import (
|
|
19
|
+
OTLPSpanExporter,
|
|
20
|
+
)
|
|
21
|
+
from opentelemetry.sdk.resources import Resource
|
|
22
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
23
|
+
from opentelemetry.sdk.trace.export import (
|
|
24
|
+
BatchSpanProcessor,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
DEFAULT_SERVICE_NAME = 'garf'
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def initialize_tracer():
|
|
31
|
+
resource = Resource.create(
|
|
32
|
+
{'service.name': os.getenv('OTLP_SERVICE_NAME', DEFAULT_SERVICE_NAME)}
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
tracer_provider = TracerProvider(resource=resource)
|
|
36
|
+
|
|
37
|
+
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)
|
|
42
|
+
trace.set_tracer_provider(tracer_provider)
|
|
@@ -14,14 +14,18 @@
|
|
|
14
14
|
|
|
15
15
|
"""Defines common functionality between executors."""
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
import asyncio
|
|
18
|
+
|
|
19
|
+
from opentelemetry import trace
|
|
18
20
|
|
|
19
21
|
from garf_executors import execution_context
|
|
22
|
+
from garf_executors.telemetry import tracer
|
|
20
23
|
|
|
21
24
|
|
|
22
25
|
class Executor:
|
|
23
26
|
"""Defines common functionality between executors."""
|
|
24
27
|
|
|
28
|
+
@tracer.start_as_current_span('api.execute_batch')
|
|
25
29
|
def execute_batch(
|
|
26
30
|
self,
|
|
27
31
|
batch: dict[str, str],
|
|
@@ -38,17 +42,28 @@ class Executor:
|
|
|
38
42
|
Returns:
|
|
39
43
|
Results of execution.
|
|
40
44
|
"""
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
45
|
+
span = trace.get_current_span()
|
|
46
|
+
span.set_attribute('api.parallel_threshold', parallel_threshold)
|
|
47
|
+
return asyncio.run(
|
|
48
|
+
self._run(
|
|
49
|
+
batch=batch, context=context, parallel_threshold=parallel_threshold
|
|
50
|
+
)
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
async def _run(
|
|
54
|
+
self,
|
|
55
|
+
batch: dict[str, str],
|
|
56
|
+
context: execution_context.ExecutionContext,
|
|
57
|
+
parallel_threshold: int,
|
|
58
|
+
):
|
|
59
|
+
semaphore = asyncio.Semaphore(value=parallel_threshold)
|
|
60
|
+
|
|
61
|
+
async def run_with_semaphore(fn):
|
|
62
|
+
async with semaphore:
|
|
63
|
+
return await fn
|
|
64
|
+
|
|
65
|
+
tasks = [
|
|
66
|
+
self.aexecute(query=query, title=title, context=context)
|
|
67
|
+
for title, query in batch.items()
|
|
68
|
+
]
|
|
69
|
+
return await asyncio.gather(*(run_with_semaphore(task) for task in tasks))
|
|
@@ -16,9 +16,13 @@ import inspect
|
|
|
16
16
|
import sys
|
|
17
17
|
from importlib.metadata import entry_points
|
|
18
18
|
|
|
19
|
-
from garf_core import
|
|
19
|
+
from garf_core import report_fetcher
|
|
20
|
+
from opentelemetry import trace
|
|
20
21
|
|
|
22
|
+
from garf_executors.telemetry import tracer
|
|
21
23
|
|
|
24
|
+
|
|
25
|
+
@tracer.start_as_current_span('find_fetchers')
|
|
22
26
|
def find_fetchers() -> set[str]:
|
|
23
27
|
"""Identifiers all available report fetchers."""
|
|
24
28
|
if entrypoints := _get_entrypoints('garf'):
|
|
@@ -26,6 +30,7 @@ def find_fetchers() -> set[str]:
|
|
|
26
30
|
return set()
|
|
27
31
|
|
|
28
32
|
|
|
33
|
+
@tracer.start_as_current_span('get_report_fetcher')
|
|
29
34
|
def get_report_fetcher(source: str) -> type[report_fetcher.ApiReportFetcher]:
|
|
30
35
|
"""Loads report fetcher for a given source.
|
|
31
36
|
|
|
@@ -44,7 +49,9 @@ def get_report_fetcher(source: str) -> type[report_fetcher.ApiReportFetcher]:
|
|
|
44
49
|
for fetcher in _get_entrypoints('garf'):
|
|
45
50
|
if fetcher.name == source:
|
|
46
51
|
try:
|
|
47
|
-
|
|
52
|
+
with tracer.start_as_current_span('load_fetcher_module') as span:
|
|
53
|
+
fetcher_module = fetcher.load()
|
|
54
|
+
span.set_attribute('loaded_module', fetcher_module.__name__)
|
|
48
55
|
for name, obj in inspect.getmembers(fetcher_module):
|
|
49
56
|
if inspect.isclass(obj) and issubclass(
|
|
50
57
|
obj, report_fetcher.ApiReportFetcher
|
|
@@ -52,7 +59,7 @@ def get_report_fetcher(source: str) -> type[report_fetcher.ApiReportFetcher]:
|
|
|
52
59
|
return getattr(fetcher_module, name)
|
|
53
60
|
except ModuleNotFoundError:
|
|
54
61
|
continue
|
|
55
|
-
raise
|
|
62
|
+
raise report_fetcher.ApiReportFetcherError(
|
|
56
63
|
f'No fetcher available for the source "{source}"'
|
|
57
64
|
)
|
|
58
65
|
|
|
@@ -28,8 +28,10 @@ import re
|
|
|
28
28
|
|
|
29
29
|
import pandas as pd
|
|
30
30
|
from garf_core import query_editor, report
|
|
31
|
+
from opentelemetry import trace
|
|
31
32
|
|
|
32
33
|
from garf_executors import exceptions, execution_context, executor
|
|
34
|
+
from garf_executors.telemetry import tracer
|
|
33
35
|
|
|
34
36
|
logger = logging.getLogger(__name__)
|
|
35
37
|
|
|
@@ -66,6 +68,7 @@ class SqlAlchemyQueryExecutor(
|
|
|
66
68
|
engine = sqlalchemy.create_engine(connection_string)
|
|
67
69
|
return cls(engine)
|
|
68
70
|
|
|
71
|
+
@tracer.start_as_current_span('sql.execute')
|
|
69
72
|
def execute(
|
|
70
73
|
self,
|
|
71
74
|
query: str,
|
|
@@ -84,6 +87,7 @@ class SqlAlchemyQueryExecutor(
|
|
|
84
87
|
Returns:
|
|
85
88
|
Report with data if query returns some data otherwise empty Report.
|
|
86
89
|
"""
|
|
90
|
+
span = trace.get_current_span()
|
|
87
91
|
logging.info('Executing script: %s', title)
|
|
88
92
|
query_text = self.replace_params_template(query, context.query_parameters)
|
|
89
93
|
with self.engine.begin() as conn:
|
|
@@ -115,4 +119,5 @@ class SqlAlchemyQueryExecutor(
|
|
|
115
119
|
)
|
|
116
120
|
logger.info('%s executed successfully', title)
|
|
117
121
|
return writing_result
|
|
122
|
+
span.set_attribute('execute.num_results', len(results))
|
|
118
123
|
return results
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Copyright 2025 Google LLC
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# https://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
# pylint: disable=C0330, g-bad-import-order, g-multiple-import
|
|
16
|
+
from opentelemetry import trace
|
|
17
|
+
|
|
18
|
+
tracer = trace.get_tracer(
|
|
19
|
+
instrumenting_module_name='garf_executors',
|
|
20
|
+
)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: garf-executors
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: Executes queries against API and writes data to local/remote storage.
|
|
5
5
|
Author-email: "Google Inc. (gTech gPS CSE team)" <no-reply@google.com>, Andrei Markin <andrey.markin.ppc@gmail.com>
|
|
6
6
|
License: Apache 2.0
|
|
@@ -21,6 +21,8 @@ Requires-Dist: garf-core
|
|
|
21
21
|
Requires-Dist: garf-io
|
|
22
22
|
Requires-Dist: pyyaml
|
|
23
23
|
Requires-Dist: pydantic
|
|
24
|
+
Requires-Dist: opentelemetry-api
|
|
25
|
+
Requires-Dist: opentelemetry-sdk
|
|
24
26
|
Provides-Extra: bq
|
|
25
27
|
Requires-Dist: garf-io[bq]; extra == "bq"
|
|
26
28
|
Requires-Dist: pandas; extra == "bq"
|
|
@@ -30,6 +32,8 @@ Requires-Dist: garf-io[sqlalchemy]; extra == "sql"
|
|
|
30
32
|
Requires-Dist: pandas; extra == "sql"
|
|
31
33
|
Provides-Extra: server
|
|
32
34
|
Requires-Dist: fastapi[standard]; extra == "server"
|
|
35
|
+
Requires-Dist: opentelemetry-instrumentation-fastapi; extra == "server"
|
|
36
|
+
Requires-Dist: opentelemetry-exporter-otlp; extra == "server"
|
|
33
37
|
Provides-Extra: all
|
|
34
38
|
Requires-Dist: garf-executors[bq,server,sql]; extra == "all"
|
|
35
39
|
|
|
@@ -9,6 +9,7 @@ garf_executors/execution_context.py
|
|
|
9
9
|
garf_executors/executor.py
|
|
10
10
|
garf_executors/fetchers.py
|
|
11
11
|
garf_executors/sql_executor.py
|
|
12
|
+
garf_executors/telemetry.py
|
|
12
13
|
garf_executors.egg-info/PKG-INFO
|
|
13
14
|
garf_executors.egg-info/SOURCES.txt
|
|
14
15
|
garf_executors.egg-info/dependency_links.txt
|
|
@@ -18,4 +19,5 @@ garf_executors.egg-info/top_level.txt
|
|
|
18
19
|
garf_executors/entrypoints/__init__.py
|
|
19
20
|
garf_executors/entrypoints/cli.py
|
|
20
21
|
garf_executors/entrypoints/server.py
|
|
22
|
+
garf_executors/entrypoints/tracer.py
|
|
21
23
|
garf_executors/entrypoints/utils.py
|
|
@@ -2,6 +2,8 @@ garf-core
|
|
|
2
2
|
garf-io
|
|
3
3
|
pyyaml
|
|
4
4
|
pydantic
|
|
5
|
+
opentelemetry-api
|
|
6
|
+
opentelemetry-sdk
|
|
5
7
|
|
|
6
8
|
[all]
|
|
7
9
|
garf-executors[bq,server,sql]
|
|
@@ -13,6 +15,8 @@ google-cloud-logging
|
|
|
13
15
|
|
|
14
16
|
[server]
|
|
15
17
|
fastapi[standard]
|
|
18
|
+
opentelemetry-instrumentation-fastapi
|
|
19
|
+
opentelemetry-exporter-otlp
|
|
16
20
|
|
|
17
21
|
[sql]
|
|
18
22
|
garf-io[sqlalchemy]
|
|
@@ -9,6 +9,8 @@ dependencies = [
|
|
|
9
9
|
"garf-io",
|
|
10
10
|
"pyyaml",
|
|
11
11
|
"pydantic",
|
|
12
|
+
"opentelemetry-api",
|
|
13
|
+
"opentelemetry-sdk",
|
|
12
14
|
]
|
|
13
15
|
authors = [
|
|
14
16
|
{name = "Google Inc. (gTech gPS CSE team)", email = "no-reply@google.com"},
|
|
@@ -48,6 +50,8 @@ sql=[
|
|
|
48
50
|
]
|
|
49
51
|
server=[
|
|
50
52
|
"fastapi[standard]",
|
|
53
|
+
"opentelemetry-instrumentation-fastapi",
|
|
54
|
+
"opentelemetry-exporter-otlp",
|
|
51
55
|
]
|
|
52
56
|
all = [
|
|
53
57
|
"garf-executors[bq,sql,server]"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|