-
Notifications
You must be signed in to change notification settings - Fork 199
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
21 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,31 @@ | ||
"""Implements SupportsTracking""" | ||
from dlt.pipeline.trace import PipelineTrace, PipelineStepTrace, TPipelineStep, SupportsPipeline | ||
from typing import Any | ||
|
||
from dlt.sources.helpers import requests | ||
from dlt.pipeline.trace import PipelineTrace, PipelineStepTrace, TPipelineStep, SupportsPipeline | ||
from dlt.common import json | ||
|
||
count = 0 | ||
|
||
def _send_to_beacon(trace: PipelineTrace, step: PipelineStepTrace, pipeline: SupportsPipeline): | ||
if not pipeline.runtime_config.beacon_token or not pipeline.runtime_config.beacon_url: | ||
return | ||
def _send_to_beacon(trace: PipelineTrace, step: PipelineStepTrace, pipeline: SupportsPipeline, some): | ||
if pipeline.runtime_config.beacon_token and pipeline.runtime_config.beacon_url: | ||
trace_dump = json.dumps(trace.asdict()) | ||
url = f"{pipeline.runtime_config.beacon_url}/pipeline/{pipeline.runtime_config.beacon_token}/traces" | ||
requests.put(url, json=trace_dump) | ||
|
||
def on_start_trace(trace: PipelineTrace, step: TPipelineStep, pipeline: SupportsPipeline) -> None: | ||
_send_to_beacon(trace, step, pipeline, None) | ||
# _send_to_beacon(trace, step, pipeline, None) | ||
pass | ||
|
||
def on_start_trace_step(trace: PipelineTrace, step: TPipelineStep, pipeline: SupportsPipeline) -> None: | ||
_send_to_beacon(trace, step, pipeline, None) | ||
# _send_to_beacon(trace, step, pipeline, None) | ||
pass | ||
|
||
def on_end_trace_step(trace: PipelineTrace, step: PipelineStepTrace, pipeline: SupportsPipeline, step_info: Any) -> None: | ||
_send_to_beacon(trace, step, pipeline, step_info) | ||
# _send_to_beacon(trace, step, pipeline, step_info) | ||
pass | ||
|
||
def on_end_trace(trace: PipelineTrace, pipeline: SupportsPipeline) -> None: | ||
_send_to_beacon(trace, None, pipeline, None) | ||
|
||
pass | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters