-
Notifications
You must be signed in to change notification settings - Fork 462
feat: store tracer configuration in an in-memory file #3171
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
Conversation
Datadog ReportBranch report: ✅ 0 Failed, 5386 Passed, 73 Skipped, 2m 48.75s Total Time |
BenchmarksBenchmark execution time: 2025-03-07 14:03:29 Comparing candidate commit b4c3297 in PR branch Found 0 performance improvements and 1 performance regressions! Performance is the same for 59 metrics, 2 unstable metrics. scenario:BenchmarkStartRequestSpan-24
|
9ba3247
to
f6a9d79
Compare
ddtrace/tracer/tracer.go
Outdated
|
||
metadata := TracerMetadata{ | ||
SchemaVersion: 1, | ||
RuntimeId: "TBD", ///< Where to get it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I need guidance here on how to get this the runtimeID.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globalconfig.RuntimeID()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 7bb75db
ddtrace/tracer/tracer.go
Outdated
SchemaVersion: 1, | ||
RuntimeId: "TBD", ///< Where to get it? | ||
Language: "golang", | ||
Version: "1.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the tracer's version, it's in internal/version.Tag
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
addressed in 7bb75db
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you provide some context? What's the goal and intended use case for storing the config in an in-memory file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should implement testing for this covering the different situations. You can use runtime.GOOS == "linux"
to run the test only in Linux.
ddtrace/tracer/tracer.go
Outdated
|
||
metadata := TracerMetadata{ | ||
SchemaVersion: 1, | ||
RuntimeId: "TBD", ///< Where to get it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globalconfig.RuntimeID()
ddtrace/tracer/tracer.go
Outdated
SchemaVersion: 1, | ||
RuntimeId: "TBD", ///< Where to get it? | ||
Language: "golang", | ||
Version: "1.2.3", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the tracer's version, it's in internal/version.Tag
.
Unless I mock the syscall, I am afraid this not very testable. Do you have anything else in mind @darccio? |
@dmehala Why do you need to mock the call? |
@darccio Well, if the goal is to check that the memfd is created and contains the correct value, we already have a system test for that. Would that be enough, or are you looking for something more? |
@dmehala If we have a system test for this, let's go forward. |
// store the configuration in an in-memory file, allowing it to be read to | ||
// determine if the process is instrumented with a tracer and to retrive | ||
// relevant tracing information. | ||
storeConfig(t.config) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👋 I came across the code in this PR (and the RFC for it) today. It's really cool. I didn't know about the memfd syscalls - I might have some use cases for it in the future as well!
Anyway, I'm commenting b/c I think there is a slight problem here. This code is only considering the tracer product. I think there is a problem when a customer is only enabling the profiler, but not the tracer. This does happen sometimes in the real world AFAIK.
What does this PR do?
This is PR store the tracer configuration in an memfd file.
APMAPI-1070
Motivation
Process Discovery.
Note to reviewers
Sorry, I am not well-versed in Go. Please feel free to take over the pull request to ensure it aligns more closely with idiomatic practices and fits better within the codebase.
Reviewer's Checklist
v2-dev
branch and reviewed by @DataDog/apm-go.Unsure? Have a question? Request a review!