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 metric_type mapping to stat datastream of HA Proxy #7183

Merged
merged 6 commits into from
Aug 9, 2023

Conversation

agithomas
Copy link
Contributor

Type of Change

  • Enhancement

What does this PR do?

Add metric_type mapping to stat datastream of HA Proxy

Checklist

  • I have reviewed tips for building integrations and this pull request is aligned with them.
  • I have verified that all data streams collect metrics or logs.
  • I have added an entry to my package's changelog.yml file.
  • I have verified that Kibana version constraints are current according to guidelines.

How to test this PR locally

  • elastic-package build
  • elastic-package stack up -v -d --services package-registry

Related issues

@agithomas agithomas mentioned this pull request Jul 28, 2023
20 tasks
@elasticmachine
Copy link

elasticmachine commented Jul 28, 2023

💚 Build Succeeded

the below badges are clickable and redirect to their specific view in the CI or DOCS
Pipeline View Test View Changes Artifacts preview preview

Expand to view the summary

Build stats

  • Start Time: 2023-08-01T09:21:21.455+0000

  • Duration: 15 min 1 sec

Test stats 🧪

Test Results
Failed 0
Passed 40
Skipped 0
Total 40

🤖 GitHub comments

Expand to view the GitHub comments

To re-run your PR in the CI, just comment with:

  • /test : Re-trigger the build.

@elasticmachine
Copy link

elasticmachine commented Jul 28, 2023

🌐 Coverage report

Name Metrics % (covered/total) Diff
Packages 100.0% (1/1) 💚
Files 100.0% (1/1) 💚
Classes 100.0% (1/1) 💚
Methods 90.476% (19/21) 👎 -6.494
Lines 97.297% (180/185) 👍 2.979
Conditionals 100.0% (0/0) 💚

@agithomas agithomas marked this pull request as ready for review July 29, 2023 05:48
@agithomas agithomas requested a review from a team as a code owner July 29, 2023 05:48
description: |
Number of connection reuses.
- name: idle
type: group
fields:
- name: total
type: long
metric_type: gauge
Copy link
Collaborator

Choose a reason for hiding this comment

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

idle.total is it a counter instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The schema definition is srv_icur.1:MGP. So, it is a gauge type.

Copy link
Collaborator

Choose a reason for hiding this comment

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

should it be named like idle.current instead?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it would have been optimal. The description goes as Current number of idle connections available for reuse on this server.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If it is to be changed, I would prefer that taken up as a separate enhancement with an assessment of impact (say dashboard changes). Agree?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yes I agree, any un-related changes can be filed as a separate backlogs. In this doc also: idle section coming empty.

      "idle": {},

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I generated some traffic to populate the value for idle. Please find the extract from the document below

"connection": {
          "reuse.total": 7,
          "retried": 0,
          "cache": {},
          "idle": {
            "total": 1
          },
          "attempt.total": 290,
          "time.avg": 1
        },
        "queue": {
          "time.avg": 0
        },
        "status": "UP",
        "client.aborted": 1,
        "compressor": {}
      }

@lalit-satapathy
Copy link
Collaborator

@agithomas, Can you share a sample "stat" document to cross-check the metric types once?

@agithomas
Copy link
Contributor Author

agithomas commented Jul 31, 2023

@agithomas, Can you share a sample "stat" document to cross-check the metric types once?

{
    "haproxy": {
      "stat": {
        "server": {
          "id": 0
        },
        "request": {
          "total": 0,
          "rate": {
            "max": 0,
            "value": 0
          },
          "denied_by_connection_rules": 0,
          "denied_by_session_rules": 0,
          "denied": 0,
          "intercepted": 0,
          "errors": 0
        },
        "agent": {
          "fall": "",
          "health": "",
          "description": "",
          "check": {
            "health": "",
            "description": "",
            "rise": ""
          },
          "rise": "",
          "status": ""
        },
        "cookie": "",
        "session": {
          "current": 0,
          "total": 0,
          "max": 0,
          "rate": {
            "max": 0,
            "limit": 0,
            "value": 0
          },
          "limit": 524262
        },
        "service_name": "FRONTEND",
        "in.bytes": 0,
        "source": {
          "address": ""
        },
        "check": {
          "agent.last": "",
          "health.last": "",
          "status": ""
        },
        "out.bytes": 0,
        "proxy": {
          "mode": "http",
          "name": "stats",
          "id": 2
        },
        "component_type": 0,
        "response": {
          "http": {
            "1xx": 0,
            "2xx": 0,
            "other": 0,
            "3xx": 0,
            "4xx": 0,
            "5xx": 0
          },
          "denied": 0
        },
        "load_balancing_algorithm": "",
        "header": {
          "rewrite": {
            "failed": {
              "total": 0
            }
          }
        },
        "connection": {
          "total": 0,
          "cache": {
            "hits": 0,
            "lookup.total": 0
          },
          "rate": 0,
          "idle": {},
          "rate_max": 0
        },
        "queue": {},
        "status": "OPEN",
        "compressor": {
          "response.bytes": 0,
          "in.bytes": 0,
          "bypassed.bytes": 0,
          "out.bytes": 0
        }
      }
    }
}

@agithomas
Copy link
Contributor Author

Document extract after traffic inflow

"haproxy": {
      "stat": {
        "server": {
          "backup": 0,
          "aborted": 0,
          "active": 1,
          "id": 1
        },
        "request": {
          "connection.errors": 0,
          "total": 297,
          "queued.current": 0,
          "rate": {},
          "queued.max": 0,
          "redispatched": 0
        },
        "agent": {
          "fall": "",
          "description": "",
          "health": "",
          "check": {
            "health": "4",
            "description": "Layer4 check passed",
            "rise": "2"
          },
          "rise": "",
          "status": ""
        },
        "cookie": "",
        "last_change": 349012,
        "session": {
          "total": 297,
          "current": 0,
          "max": 1,
          "rate": {
            "max": 3,
            "value": 0
          }
        },
        "service_name": "s1",
        "in.bytes": 64596,
        "weight": 1,
        "check": {
          "duration": 0,
          "agent.last": "",
          "failed": 0,
          "health.last": "",
          "down": 0,
          "status": "L4OK"
        },
        "source": {
          "address": "192.168.224.2:8080"
        },
        "out.bytes": 104840,
        "proxy": {
          "mode": "http",
          "name": "webservers",
          "id": 4
        },
        "component_type": 2,
        "downtime": 0,
        "selected.total": 297,
        "response": {
          "http": {
            "1xx": 0,
            "other": 0,
            "2xx": 297,
            "3xx": 0,
            "4xx": 0,
            "5xx": 0
          },
          "denied": 0,
          "time.avg": 1,
          "errors": 0
        },
        "load_balancing_algorithm": "",
        "header": {
          "rewrite": {
            "failed": {
              "total": 0
            }
          }
        },
        "connection": {
          "reuse.total": 7,
          "retried": 0,
          "cache": {},
          "idle": {
            "total": 1
          },
          "attempt.total": 290,
          "time.avg": 1
        },
        "queue": {
          "time.avg": 0
        },
        "status": "UP",
        "client.aborted": 1,
        "compressor": {}
      }
    },

@agithomas agithomas requested review from ritalwar and a team August 1, 2023 04:44
@@ -7,10 +7,12 @@
Status (UP, DOWN, NOLB, MAINT, or MAINT(via)...).
- name: weight
type: long
metric_type: gauge
Copy link
Collaborator

Choose a reason for hiding this comment

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

@agithomas, Please cross check once if it is counter/gauge.

haproxy doc:

  1. weight [..BS]: total effective weight (backend), effective weight (server)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mapping is MaP, with a indicating an average value. So, it is a gauge type.

@@ -306,15 +354,18 @@
- name: agent.last
type: integer
- name: failed
metric_type: counter
Copy link
Collaborator

Choose a reason for hiding this comment

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

This looks like a wrong type. Can we cross check?

    "check": {
      "agent.last": "",
    }

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know that it is a bug and hence i didn't assign any metric_type mapping to check.agent.last field.

Bug reported here : #7202

description: |
Number of data transfers aborted by the server. This value is included in haproxy.stat.response.errors.
- name: active
type: integer
metric_type: gauge
Copy link
Collaborator

Choose a reason for hiding this comment

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

Need to cross check this is counter or gauge, since aborted and backup are counter for server group.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The mapping is SGP. So, it is a gauge type

@agithomas agithomas marked this pull request as draft August 1, 2023 06:04
@agithomas agithomas marked this pull request as ready for review August 1, 2023 06:05
@agithomas
Copy link
Contributor Author

@lalit-satapathy , can you please approve if all looks good?

@agithomas agithomas merged commit c8bb1a9 into elastic:main Aug 9, 2023
1 check passed
@elasticmachine
Copy link

Package haproxy - 1.8.1 containing this change is available at https://epr.elastic.co/search?package=haproxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants