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

[Alerting] Telemetry for calling legacy routes #111885

Merged
merged 6 commits into from
Sep 13, 2021

Conversation

chrisronline
Copy link
Contributor

@chrisronline chrisronline commented Sep 10, 2021

Resolves #111894

This PR introduces usage counter telemetry for legacy alerting HTTP routes.

I synced with @Bamieh and he mentioned this is a good use for usage counters. I'd imagine we have some existing dashboards already charting these data points, but if not, easy to add.

@Bamieh also mentioned we should add a consistent counter_type to perform group aggregations across all data points, so I added it and it's set to legacy_api_usage for now. This isn't used anywhere else, but we could prefix alerting_ to ensure we don't conflict in the future if we want.

To test, visit any legacy alerting HTTP url and then check telemetry stats (via https://localhost:5601/api/stats?extended):

{
  "usage_counters": {
    "daily_events": [
      {
        "domain_id": "alerts",
        "counter_name": "legacy_route_list_alert_types",
        "counter_type": "count",
        "last_updated_at": "2021-09-10T16:31:07.255Z",
        "from_timestamp": "2021-09-10T00:00:00Z",
        "total": 1
      },
      {
        "domain_id": "alerts",
        "counter_name": "legacy_route_get",
        "counter_type": "count",
        "last_updated_at": "2021-09-10T16:31:27.262Z",
        "from_timestamp": "2021-09-10T00:00:00Z",
        "total": 2
      },
      {
        "domain_id": "alerts",
        "counter_name": "legacy_route_list_alert_types",
        "counter_type": "route_access",
        "last_updated_at": "2021-09-10T16:42:02.400Z",
        "from_timestamp": "2021-09-10T00:00:00Z",
        "total": 1
      },
      {
        "domain_id": "alerts",
        "counter_name": "legacy_route_get",
        "counter_type": "route_access",
        "last_updated_at": "2021-09-10T16:42:02.399Z",
        "from_timestamp": "2021-09-10T00:00:00Z",
        "total": 1
      }
    ]
  }
}

@chrisronline chrisronline added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.16.0 Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework labels Sep 10, 2021
@chrisronline chrisronline requested a review from a team as a code owner September 10, 2021 16:49
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-alerting-services (Team:Alerting Services)

Copy link
Contributor

@YulNaumenko YulNaumenko left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@ymao1 ymao1 left a comment

Choose a reason for hiding this comment

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

LGTM! Just some nits about the naming.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@chrisronline chrisronline merged commit f8449a2 into elastic:master Sep 13, 2021
chrisronline added a commit to chrisronline/kibana that referenced this pull request Sep 13, 2021
* Telemetry for calling legacy routes

* Fix types

* Use different counter type

* PR feedback

* Fix this test too
# Conflicts:
#	x-pack/plugins/alerting/server/routes/legacy/create.ts
@chrisronline chrisronline deleted the alerting/legacy_telemetry branch September 13, 2021 18:01
chrisronline added a commit that referenced this pull request Sep 13, 2021
* [Alerting] Telemetry for calling legacy routes (#111885)

* Telemetry for calling legacy routes

* Fix types

* Use different counter type

* PR feedback

* Fix this test too
# Conflicts:
#	x-pack/plugins/alerting/server/routes/legacy/create.ts

* Fix missing arg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Alerting/RulesFramework Issues related to the Alerting Rules Framework release_note:skip Skip the PR/issue when compiling release notes Team:ResponseOps Label for the ResponseOps team (formerly the Cases and Alerting teams) v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Alerting] Add telemetry for legacy HTTP API usage
5 participants