-
Notifications
You must be signed in to change notification settings - Fork 814
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
[core] service metadata collection #1611
Conversation
31bde51
to
8fc6528
Compare
@@ -564,6 +586,14 @@ def run(self): | |||
tb=traceback.format_exc() | |||
) | |||
instance_statuses.append(instance_status) | |||
# Generate empty metadata if nonexistent | |||
service_metadata_count = len(self.service_metadata) | |||
if service_metadata_count > i + 1: |
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.
why does it matter ?
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.
self.service_metadata
is indexing integration metadata dictionnary by instance.
This mechanism makes sure that the number of metadata dictionnaries generated matches the number of instances: if an instance does not produce any meta (purposely or because it's failing), we complete self.service_metadata
adding some padding.
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 see, i don't really like the fact that it prevents from calling
self.svc_metadata
more than once per instance. This is bad pattern i think.
78458b3
to
9d80cb3
Compare
9d80cb3
to
98457ed
Compare
Do you have a "standard" metadata payload ? |
Failing on Flake8, can you fix please ? |
ef87bfa
to
c751e15
Compare
Test are passing. @remh Shall we merge it ? |
* Interface for collecting metadata * Splitting payload to distinguish data and metadata * Two endpoints: /intake/metrics and /intake/metadata * '_collect_metadata' functions for a few checks * Option to display metadata locally in `info` command * Tests Rebased on 5.2.1 agent release
`AgentCheck.service_metadata(metadata_name, value)` replaces `AgentCheck.svc_metadata(metadata_dict)` method. Under the hood, metadata are stored in a list, and rolled-up to a dictionnary for every instance. Usage: ``` self.service_metadata('foo', "bar") ```
c751e15
to
5ab8473
Compare
[core] service metadata collection
Service metadata collection
Update 05/18
AgentCheck.service_metadata(metadata_name, value)
replacesAgentCheck.svc_metadata(metadata_dict)
method.Under the hood, metadata are stored in a list, and rolled-up to a dictionnary for every instance.
Usage:
Changes
AgentCheck interface
Following methods were added to
AgentCheck
interface to support service metadata collection:To send metadata from an Agent Check, decorate it with
self.svc_metadata(...)
statements.Payload refactoring
Collector payload was re-factored behind
AgentPayload
interface: it offers the same single payload style interface but manages, distinguishes two payloads:Each of these payloads can be automatically submitted to a specific endpoint.
Before
Now:
Collector
Collector
run
method was reorganised to successively populate the payload by data type (it used to be more random).Steps are:
*
self._build_payload(...)
: only builds the payload skeleton, so it contains all of the generic payload data (no metadata).* Metrics
* Events
* Service checks
*
self._populate_payload_metadata(...)
: periodically populates the payload with metadata related to the system, host, and/or checks.Displaying metadata
agent
check
commandAgent
check
command now displays collected metadata, in addition to metrics, events and service checks.agent
info
commandSet
display_service_metadata
to True indatadog.conf
file.A new Service metadata section is now displayed in the

info
command output whenever service metadata are collected.Thoughts
Split data and metadata ?
Currently data and metadata from the agent are part of the same payload, which is processed by a single handler in Sobotka.
Metadata are extracted, directly written to Postgres when data are forwarded to Kafka.
As the volume of metadata is growing, it would be wiser to split data and metadata processing, so that postgres operations would not slow down the agent data pipeline.
First suggestion made was to have two different Sobotka handlers specific for data and metadata:
https://docs.google.com/document/d/10LAKQ1E_ez4jgTn_czFJwDkEIghGFUFsDF03LgY8QRE
Include host tags in the data payload ?
Host tags are now listed in the metadata payload only.
As it is possibly sent in a different packet (to a different endpoint), it may lead to a 'no tag' situation when a data payload is received before any metadata's.
A workaround would be to add/duplicate host tags in the data payload, but it breaks the Sobotka handler logic described in the section above.
For now
Single payload/endpoint for metrics and metadata
Let's keep it simple for now, so we can test and play with metadata support internally with the 5.4 agent release.
As the volume of metadata is still low, I can set
AgentPayload
to send a single data+metadata payload to the current/intake
endpoint.TODO
/intake
endpoint (c.f. 'Single endpoint for metrics and metadata' section)