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

Add adapter telemetry method for core model run snowplow event. #328

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

VersusFacit
Copy link
Contributor

resolves #301
docs dbt-labs/docs.getdbt.com/#

Problem

We need a way to expose adapter telemetry for our internal product adoption analytics.

Solution

The base adapter provides a simple method which is used in dbt core and its tracking system. This method will be overwritten for each adapter that we wish to collect telemetry for.

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/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

@VersusFacit VersusFacit requested a review from a team as a code owner October 16, 2024 10:27
@cla-bot cla-bot bot added the cla:yes label Oct 16, 2024
Copy link

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.

@VersusFacit
Copy link
Contributor Author

Proof of operation for fallback method (i.e. adapter does not override)

image

Note adapter_details is {}. It'll be non-empty in, say, snowflake (here) which provides an override with snowflake-specific info. This field is optional in our JSON schema.



@dataclass(frozen=True, eq=False, repr=False)
class AdapterTrackingRelationInfo(FakeAPIObject, Hashable):
Copy link
Contributor

Choose a reason for hiding this comment

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

This is an interesting case to me: should this actually be considered a "contract" like AdapterResponse or is it tied to the concept of a relation (i.e. the thing it's tracking)? If the former we should probably put it in it's own module in dbt/adapters/contracts. I think there's an argument for both so curious what others think

Copy link
Contributor Author

@VersusFacit VersusFacit Oct 18, 2024

Choose a reason for hiding this comment

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

So just putting this forward -- I originally had it as a contract. Then it ran into "can't instantiate protocol" errors. So I'm not sure it should be a contract on that alone!

To me, I had it as something related to the object it's related to because I think in terms of object traits a lot :)

@colin-rogers-dbt
Copy link
Contributor

Is this unit test-able?

dbt/adapters/base/impl.py Outdated Show resolved Hide resolved
@@ -1743,6 +1746,15 @@ def capabilities(cls) -> CapabilityDict:
def supports(cls, capability: Capability) -> bool:
return bool(cls.capabilities()[capability])

@available
@classmethod
def get_adapter_run_info(cls, config: RelationConfig) -> AdapterTrackingRelationInfo:
Copy link
Contributor

Choose a reason for hiding this comment

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

RelationConfig doesn't feel like the correct type. I would have guessed this is some version of NodeConfig.

Copy link
Contributor Author

@VersusFacit VersusFacit Oct 22, 2024

Choose a reason for hiding this comment

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

I don't have a good handle on the differences here. When I did introspection, we are passing in a RelationConfig. I bet I'm missing some appreciation of all these different Config objects and perhaps I was "lead on" by the suggestion for RelationConfig in the original ticket. If you feel strongly on this type, please do offer your thoughts here! I'm actively learning here.

dbt/adapters/base/impl.py Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature] Adapters Model Configuration Snowplow Tracking
3 participants