Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DBT model instrumentation #11268

Draft
wants to merge 12 commits into
base: main
Choose a base branch
from

Conversation

sfc-gh-vguttha
Copy link

@sfc-gh-vguttha sfc-gh-vguttha commented Feb 3, 2025

OpenTelemetry API: The API defines the interface for how to instrument your code. It specifies the functions and methods you use to generate telemetry data (traces, metrics, and logs). It's essentially a set of rules and specifications that dictate how instrumentation should be implemented. The API is no-op by default unless an SDK is configured.

OpenTelemetry SDK: The SDK provides the implementation of the API. It contains the actual code that collects, processes, and exports the telemetry data generated by the API. It handles the heavy lifting of managing telemetry data, such as sampling, buffering, and exporting it to observability backends.

Problem

Solution

Checklist

  • I have read the contributing guide and understand what's expected of me.
  • I have run this code in development, and it appears to resolve the stated issue.
  • This PR includes tests, or tests are not required or relevant for this PR.
  • This PR has no interface changes (e.g., macros, CLI, logs, JSON artifacts, config files, adapter interface, etc.) or this PR has already received feedback and approval from Product or DX.
  • This PR includes type annotations for new and modified functions.

@sfc-gh-vguttha sfc-gh-vguttha requested a review from a team as a code owner February 3, 2025 11:02
Copy link

cla-bot bot commented Feb 3, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link
Contributor

github-actions bot commented Feb 3, 2025

Thank you for your pull request! We could not find a changelog entry for this change. For details on how to document a change, see the contributing guide.

@github-actions github-actions bot added the community This PR is from a community member label Feb 3, 2025
Copy link

cla-bot bot commented Feb 17, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

@sfc-gh-vguttha sfc-gh-vguttha marked this pull request as draft February 17, 2025 08:36
Copy link

cla-bot bot commented Feb 17, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

@sfc-gh-bdrutu sfc-gh-bdrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider to add tests, for that you can use the in memory SpanProcessor, make sure if you do that to use the SDK as a test dependency only.

Copy link

cla-bot bot commented Feb 18, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

cla-bot bot commented Feb 18, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Comment on lines +1 to +5
git+https://github.com/sfc-gh-vguttha/dbt-adapters.git@vguttha-add-telemetry#subdirectory=dbt-adapters
git+https://github.com/dbt-labs/dbt-adapters.git@main#subdirectory=dbt-tests-adapter
git+https://github.com/dbt-labs/dbt-common.git@main
git+https://github.com/dbt-labs/dbt-adapters.git@main#subdirectory=dbt-postgres
git+https://github.com/sfc-gh-vguttha/dbt-adapters.git@vguttha-add-telemetry#subdirectory=dbt-snowflake
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI: will revert these changes once I am fully complete with my testing.

Copy link

cla-bot bot commented Feb 20, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

cla-bot bot commented Feb 20, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

@bogdandrutu bogdandrutu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add the following description:

**OpenTelemetry API:** The API defines the interface for how to instrument your code. It specifies the functions and methods you use to generate telemetry data (traces, metrics, and logs). It's essentially a set of rules and specifications that dictate how instrumentation should be implemented. The API is no-op by default unless an SDK is configured.

**OpenTelemetry SDK:** The SDK provides the implementation of the API. It contains the actual code that collects, processes, and exports the telemetry data generated by the API. It handles the heavy lifting of managing telemetry data, such as sampling, buffering, and exporting it to observability backends.

@@ -242,10 +261,16 @@ def call_runner(self, runner: BaseRunner) -> RunResult:
result = None
thread_exception = e
finally:
if result.status in (NodeStatus.Error, NodeStatus.Fail, NodeStatus.PartialSuccess):
node_span.set_status(StatusCode.ERROR)
node_span.set_attribute("node.status", result.status.value)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add this as the description for the status?

@@ -242,10 +261,16 @@ def call_runner(self, runner: BaseRunner) -> RunResult:
result = None
thread_exception = e
finally:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Java I know that the resource (in try-with-resource pattern) is closed before calling finally (would be the span in this case). Is this the case in Python as well?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but this try-catch-finally is different inner scope within with block correct?

if result is not None:
fire_event(
NodeFinished(
node_info=runner.node.node_info,
node_info=node_info,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this change?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to refer some attributes in node_info at different place and using full name seems lengthy and difficult to read hence shortened it.

@@ -256,7 +281,7 @@ def call_runner(self, runner: BaseRunner) -> RunResult:
GenericExceptionOnRun(
unique_id=runner.node.unique_id,
exc=str(thread_exception),
node_info=runner.node.node_info,
node_info=node_info,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

Copy link

cla-bot bot commented Feb 26, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

cla-bot bot commented Feb 26, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Copy link

cla-bot bot commented Feb 26, 2025

Thanks for your pull request, and welcome to our community! We require contributors to sign our Contributor License Agreement and we don't seem to have your signature on file. Check out this article for more information on why we have a CLA.

In order for us to review and merge your code, please submit the Individual Contributor License Agreement form attached above above. If you have questions about the CLA, or if you believe you've received this message in error, please reach out through a comment on this PR.

CLA has not been signed by users: @sfc-gh-vguttha

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community This PR is from a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants