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

[ddtelemetry] Implement ffi code for telemetry metrics #331

Merged
merged 10 commits into from
Mar 11, 2024

Conversation

paullegranddc
Copy link
Contributor

What does this PR do?

  • Add an entrypoint to the telemetry worker that doesn't send app-events, just metrics and logs for use in languages that already have a telemetry client sending app-events, but want to send telemetry metrics from the native side

  • Expose telemetry metrics API to the ffi

  • Refactor the telemetry API to use NonNull<Box<Type>> instead of &mut *mut Type to represent out parameters.
    This doesn't have any impact on the generated C headers, or the ffi API since this types have the exact same ABI, but it expresses intent better IMO.

Motivation

This is needed because Christophe Nasarre wants to use libdatadog to send telemetry metrics from the dotnet profiler, from the native library side.

Additional Notes

Anything else we should know when reviewing?

How to test the change?

Describe here in detail how the change can be validated.

For Reviewers

  • If this PR touches code that signs or publishes builds or packages, or handles credentials of any kind, I've requested a review from @DataDog/security-design-and-guidance.
  • This PR doesn't touch any of that.

@paullegranddc paullegranddc requested a review from a team as a code owner February 26, 2024 14:43
@gleocadie
Copy link
Contributor

Is it possible to have an example in C/C++ in https://github.com/DataDog/libdatadog/tree/main/examples/ffi to show how to use the API please ?
It could be also used to check that the functions are correctly exported and can be used.

@paullegranddc paullegranddc requested a review from a team as a code owner March 8, 2024 14:13
* Add comment documenting methods on the API
* Add add add_points_with_tags method if extra tags are used
@paullegranddc paullegranddc force-pushed the paullgdc/ddtelemetry/only_metrics_worker branch from fee12e3 to c815bbb Compare March 8, 2024 17:29
@gleocadie gleocadie self-requested a review March 11, 2024 08:17
Copy link
Contributor

@gleocadie gleocadie left a comment

Choose a reason for hiding this comment

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

LGTM

@paullegranddc paullegranddc merged commit d1b2cb4 into main Mar 11, 2024
20 checks passed
@paullegranddc paullegranddc deleted the paullgdc/ddtelemetry/only_metrics_worker branch March 11, 2024 13:28
bantonsson pushed a commit that referenced this pull request Mar 25, 2024
* Add an entrypoint to the telemetry worker that doesn't send app-events such as app-started
* Add ffi functions to send telemetry metrics
* Add shutdown with timeout method
* Add comment documenting methods on the API
* Add add add_points_with_tags method if extra tags are used
* Add telemetry logs and metrics example
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants