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 runtime metrics worker #988

Merged
merged 1 commit into from
Apr 1, 2020
Merged

Conversation

delner
Copy link
Contributor

@delner delner commented Mar 31, 2020

Extracted from #879

This pull request introduces the Datadog::Workers::RuntimeMetrics worker, which is responsible for collecting and submitting runtime metrics via Statsd. The pull request effectively extracts this runtime metrics behavior from the AsyncTransport which runtime metrics had previously hitchhiked on; it now separates it into its own thread and component, by using the same base as the AsyncTraceWriter.

It is the complement to AsyncTraceWriter in the respect that the combination of the two replace the responsibilities of Datadog::Writer; we will use this component when we also transition to the new TraceWriter by default.

@delner delner added core Involves Datadog core libraries dev/refactor Involves refactoring existing components labels Mar 31, 2020
@delner delner added this to the 0.35.0 milestone Mar 31, 2020
@delner delner requested review from marcotc, brettlangdon and a team March 31, 2020 20:08
@delner delner self-assigned this Mar 31, 2020

self.enabled = options.fetch(
:enabled,
Datadog::Environment.env_to_bool(Ext::Runtime::Metrics::ENV_ENABLED, false)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually want this to be driven by the configuration settings entirely (by passing it in via options) and remove the reference to the environment variable. This is a short-term behavior while we re-work configuration settings a bit.

@metrics = options.fetch(:metrics, Runtime::Metrics.new)

# Workers::Async::Thread settings
self.fork_policy = options.fetch(:fork_policy, Workers::Async::Thread::FORK_POLICY_STOP)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't want forks to collect runtime metrics by default; this policy prevents the runtime metrics worker from restarting and collecting metrics.

Copy link
Member

@marcotc marcotc left a comment

Choose a reason for hiding this comment

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

💯!

@delner delner merged commit b17a61c into master Apr 1, 2020
@delner delner deleted the feature/add_runtime_metrics_worker branch April 1, 2020 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Involves Datadog core libraries dev/refactor Involves refactoring existing components
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants