|
32 | 32 | from schematic.configuration.configuration import CONFIG |
33 | 33 | from schematic.utils.google_api_utils import export_manifest_drive_service |
34 | 34 |
|
| 35 | +from opentelemetry import trace |
35 | 36 |
|
36 | 37 | logger = logging.getLogger(__name__) |
| 38 | +tracer = trace.get_tracer("Schematic") |
37 | 39 |
|
38 | 40 |
|
39 | 41 | class ManifestGenerator(object): |
@@ -1289,6 +1291,7 @@ def _gather_all_fields(self, fields, json_schema): |
1289 | 1291 | ) |
1290 | 1292 | return required_metadata_fields |
1291 | 1293 |
|
| 1294 | + @tracer.start_as_current_span("ManifestGenerator::get_empty_manifest") |
1292 | 1295 | def get_empty_manifest( |
1293 | 1296 | self, |
1294 | 1297 | strict: Optional[bool], |
@@ -1334,6 +1337,7 @@ def _get_missing_columns(self, headers_1: list, headers_2: list) -> list: |
1334 | 1337 | """ |
1335 | 1338 | return set(headers_1) - set(headers_2) |
1336 | 1339 |
|
| 1340 | + @tracer.start_as_current_span("ManifestGenerator::set_dataframe_by_url") |
1337 | 1341 | def set_dataframe_by_url( |
1338 | 1342 | self, |
1339 | 1343 | manifest_url: str, |
@@ -1425,6 +1429,7 @@ def map_annotation_names_to_display_names( |
1425 | 1429 | # Use the above dictionary to rename columns in question |
1426 | 1430 | return annotations.rename(columns=label_map) |
1427 | 1431 |
|
| 1432 | + @tracer.start_as_current_span("ManifestGenerator::get_manifest_with_annotations") |
1428 | 1433 | def get_manifest_with_annotations( |
1429 | 1434 | self, annotations: pd.DataFrame, strict: Optional[bool] = None |
1430 | 1435 | ) -> Tuple[ps.Spreadsheet, pd.DataFrame]: |
@@ -1465,6 +1470,7 @@ def get_manifest_with_annotations( |
1465 | 1470 |
|
1466 | 1471 | return manifest_url, manifest_df |
1467 | 1472 |
|
| 1473 | + @tracer.start_as_current_span("ManifestGenerator::export_sheet_to_excel") |
1468 | 1474 | def export_sheet_to_excel( |
1469 | 1475 | self, title: str = None, manifest_url: str = None, output_location: str = None |
1470 | 1476 | ) -> str: |
@@ -1514,6 +1520,7 @@ def export_sheet_to_excel( |
1514 | 1520 |
|
1515 | 1521 | return output_excel_file_path |
1516 | 1522 |
|
| 1523 | + @tracer.start_as_current_span("ManifestGenerator::_handle_output_format_logic") |
1517 | 1524 | def _handle_output_format_logic( |
1518 | 1525 | self, |
1519 | 1526 | output_format: str = None, |
@@ -1570,6 +1577,7 @@ def _handle_output_format_logic( |
1570 | 1577 | return dataframe |
1571 | 1578 |
|
1572 | 1579 | @staticmethod |
| 1580 | + @tracer.start_as_current_span("ManifestGenerator::create_single_manifest") |
1573 | 1581 | def create_single_manifest( |
1574 | 1582 | path_to_data_model: str, |
1575 | 1583 | graph_data_model: nx.MultiDiGraph, |
@@ -1623,6 +1631,7 @@ def create_single_manifest( |
1623 | 1631 | return result |
1624 | 1632 |
|
1625 | 1633 | @staticmethod |
| 1634 | + @tracer.start_as_current_span("ManifestGenerator::create_manifests") |
1626 | 1635 | def create_manifests( |
1627 | 1636 | path_to_data_model: str, |
1628 | 1637 | data_types: list, |
@@ -1751,6 +1760,7 @@ def create_manifests( |
1751 | 1760 |
|
1752 | 1761 | return all_results |
1753 | 1762 |
|
| 1763 | + @tracer.start_as_current_span("ManifestGenerator::get_manifest") |
1754 | 1764 | def get_manifest( |
1755 | 1765 | self, |
1756 | 1766 | dataset_id: str = None, |
@@ -1998,6 +2008,9 @@ def _format_new_excel_column(self, worksheet, new_column_index: int, col: str): |
1998 | 2008 | ) |
1999 | 2009 | return worksheet |
2000 | 2010 |
|
| 2011 | + @tracer.start_as_current_span( |
| 2012 | + "ManifestGenerator::populate_existing_excel_spreadsheet" |
| 2013 | + ) |
2001 | 2014 | def populate_existing_excel_spreadsheet( |
2002 | 2015 | self, existing_excel_path: str = None, additional_df: pd.DataFrame = None |
2003 | 2016 | ): |
|
0 commit comments