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

[Metricbeat] [Statsd] Add support for Graphite series 1.1.0+ tags #39619

Merged
merged 14 commits into from
May 30, 2024

Conversation

tehbooom
Copy link
Member

@tehbooom tehbooom commented May 17, 2024

Proposed commit message

Added conditional to check if statsd metric contains , or ; and split accordingly

Checklist

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in CHANGELOG.next.asciidoc or CHANGELOG-developer.next.asciidoc.

Disruptive User Impact

Author's Checklist

  • [ ]

How to test this PR locally

Related issues

Use cases

Screenshots

Screenshot 2024-05-17 at 11 14 46 AM

Logs

{
  "_index": ".ds-metricbeat-8.15.0-2024.05.17-000001",
  "_id": "iNaPho8Bf8HHEaVjdnAn",
  "_version": 1,
  "_score": 0,
  "_source": {
    "@timestamp": "2024-05-17T12:38:09.825Z",
    "service": {
      "type": "statsd"
    },
    "statsd": {
      "envoy_listener_worker_downstream_cx_active": {
        "value": 0
      }
    },
    "labels": {
      "envoy.worker_id": "10",
      "envoy.listener_address": "0.0.0.0_9001"
    },
    "ecs": {
      "version": "8.0.0"
    },
    "host": {
      "name": "mbp"
    },
    "agent": {
      "name": "mbp",
      "type": "metricbeat",
      "version": "8.15.0",
      "ephemeral_id": "41c29b63-8a18-4387-9879-a1b212dbcf8a",
      "id": "a934cbff-9d5b-4b73-84dd-363af4de9d23"
    },
    "metricset": {
      "name": "server"
    },
    "event": {
      "dataset": "statsd",
      "module": "statsd"
    }
  }
}

@tehbooom tehbooom requested a review from a team as a code owner May 17, 2024 15:31
@botelastic botelastic bot added the needs_team Indicates that the issue/PR needs a Team:* label label May 17, 2024
Copy link
Contributor

mergify bot commented May 17, 2024

This pull request does not have a backport label.
If this is a bug or security fix, could you label this PR @tehbooom? 🙏.
For such, you'll need to label your PR with:

  • The upcoming major version of the Elastic Stack
  • The upcoming minor version of the Elastic Stack (if you're not pushing a breaking change)

To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-v8./d.0 is the label to automatically backport to the 8./d branch. /d is the digit

@ycombinator ycombinator added the Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team label May 17, 2024
@botelastic botelastic bot removed the needs_team Indicates that the issue/PR needs a Team:* label label May 17, 2024
@ritalwar
Copy link
Contributor

Can you also please update the changelog?

@ritalwar ritalwar requested review from shmsr and ritalwar May 21, 2024 05:32
Copy link
Contributor

@ritalwar ritalwar left a comment

Choose a reason for hiding this comment

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

LGTM!

@@ -48,6 +48,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
*Metricbeat*

- Setting period for counter cache for Prometheus remote_write at least to 60sec {pull}38553[38553]
- Added conditional to check if statsd metric contains , or ; and split accordingly {pull}39619[39619]
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- Added conditional to check if statsd metric contains , or ; and split accordingly {pull}39619[39619]
- Added a conditional check to see if the statsd metric contains ',' or ';' and split accordingly. {pull}39619[39619]

@ritalwar
Copy link
Contributor

Hi @aliabbas-elastic , Can we verify these changes? I've opened an issue for it here.
cc: @lalit-satapathy

@aliabbas-elastic
Copy link
Contributor

Hi @aliabbas-elastic , Can we verify these changes? I've opened an #39681 for it here.

@ritalwar Ok I'll look into it

Co-authored-by: subham sarkar <sarkar.subhams2@gmail.com>
x-pack/metricbeat/module/statsd/server/data.go Outdated Show resolved Hide resolved
@@ -48,6 +48,7 @@ https://github.com/elastic/beats/compare/v8.8.1\...main[Check the HEAD diff]
*Metricbeat*

- Setting period for counter cache for Prometheus remote_write at least to 60sec {pull}38553[38553]
- Added a conditional check to see if the statsd metric contains ',' or ';' and split accordingly. {pull}39619[39619]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
- Added a conditional check to see if the statsd metric contains ',' or ';' and split accordingly. {pull}39619[39619]
- Add support of Graphite series 1.1.0+ tagging extension for statsd module. {pull}39619[39619]

Copy link
Member

Choose a reason for hiding this comment

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

Also, I think we should update README. See an example: https://github.com/prometheus/statsd_exporter?tab=readme-ov-file#tagging-extensions

@ritalwar @tehbooom What do you think? Else, one has to go to code to figure it out to see what extensions are supported.

Copy link
Member Author

@tehbooom tehbooom May 23, 2024

Choose a reason for hiding this comment

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

@ritalwar @shmsr How do we feel about adding this to the README?

[float]
=== Suported tag extensions

The `statsd` module supports the following tags:

https://docs.datadoghq.com/developers/dogstatsd/datagram_shell/?tab=metrics#the-dogstatsd-protocol[DogStatsD]

`<metric name>:<value>|<type>|@samplerate|#<k>:<v>,<k>:<v>`

https://github.com/influxdata/telegraf/blob/master/plugins/inputs/statsd/README.md#influx-statsd[InfluxDB]

`<metric name>,<k>=<v>,<k>=<v>:<value>|<type>|@samplerate`

https://graphite.readthedocs.io/en/latest/tags.html#graphite-tag-support[Graphite 1.1.x]

`<metric name>;<k>=<v>;<k>=<v>:<value>|<type>|@samplerate`

Would look like this:

image

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the heading could be like:

  • "DogStatsD-style tags"
  • "InfluxDB-style tags"

and so on.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm fine with just listing the names, but we can add something like:

Supported Tag Extensions

Examples of tag styles supported by the statsd module:

  • DogStatsD
    <metric name>:<value>|<type>|@samplerate|#<k>:<v>,<k>:<v>
  • InfluxDB
    <metric name>,<k>=<v>,<k>=<v>:<value>|<type>|@samplerate
  • Graphite 1.1.x
    <metric name>;<k>=<v>;<k>=<v>:<value>|<type>|@samplerate

Comment on lines +85 to +86
// Metric tags could be separated by `,` or `;`
// We split here based on the separator
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// Metric tags could be separated by `,` or `;`
// We split here based on the separator
// Metric tags could be separated by `,` or `;`, we split here based on the separator.

Copy link
Member

@shmsr shmsr left a comment

Choose a reason for hiding this comment

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

LGTM. Let's wait for @ritalwar to approval as well and then we can merge.

@ritalwar
Copy link
Contributor

@aliabbas-elastic, could you please do one round of testing as well so we can merge this?

Copy link
Contributor

@aliabbas-elastic aliabbas-elastic left a comment

Choose a reason for hiding this comment

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

Approving this PR but let me run one round of sanity tests for compatible metric formats. I'll update here soon

metricbeat/docs/modules/statsd.asciidoc Outdated Show resolved Hide resolved
@shmsr
Copy link
Member

shmsr commented May 29, 2024

Yes, let's wait for @aliabbas-elastic before merging

shmsr and others added 2 commits May 29, 2024 13:07
Co-authored-by: Aliabbas Attarwala <124054599+aliabbas-elastic@users.noreply.github.com>
@tehbooom tehbooom merged commit 61622ac into elastic:main May 30, 2024
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Team:Obs-InfraObs Label for the Observability Infrastructure Monitoring team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Metricbeat] Statsd Module does not support Graphite series 1.1.0+
5 participants