dagster-io / dagster

An orchestration platform for the development, production, and observation of data assets.
https://dagster.io
Apache License 2.0
11.3k stars 1.43k forks source link

Allow Datadog integration to use API methods #8050

Open stkbailey opened 2 years ago

stkbailey commented 2 years ago

Use Case

Currently, datadog_resource uses the DogStatsD methods, which require the use of a Datadog agent running in the environment. However, datadogpy also has similar API methods that could be used for sending events and metrics to Datadog.

Ideas of Implementation

The proposal here would simply be to add the api submodule from datadogy as a referenceable property on the datadog_resource during initialization of the resource. This wouldn't change any existing functionality, only allow users who do not have access to the Datadog agent to access the API methods directly from the resource.

@op(required_resource_keys={"datadog"})
def submit_metrics(context):
    dd = context.resources.datadog
    dd.event(...)    # use existing dogstatsd implementation
    dd.api.Event.create(...) # use dataogpy's API module

Additional Info

Happy to open a PR for this.


Message from the maintainers:

Excited about this feature? Give it a :thumbsup:. We factor engagement into prioritization.

alangenfeld commented 2 years ago

Looks like we do this sort of odd pattern of proxying attrs on a class to statsd methods https://github.com/dagster-io/dagster/blame/master/python_modules/libraries/dagster-datadog/dagster_datadog/resources.py#L6-L31

so adding api to point at whatever should be fine & straight forward, would happily review the PR.

stkbailey commented 2 years ago

Cool, I'll take it on then. I may also add a statsd attribute just to allow for more explicit logging options.

jeanineharb commented 1 year ago

Interested in this feature! @stkbailey need help?

stkbailey commented 1 year ago

@jeanineharb we never ended up using this and instead now just issue directly via statsd. Still seems useful though!

shivonchain commented 6 months ago

Hey @alangenfeld very interested in this and will be contributing a PR: #20602. welcome any guidance or direction!