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

Track usage by BotInstanceID #51540

Merged
merged 8 commits into from
Jan 30, 2025
Merged

Conversation

strideynet
Copy link
Contributor

@strideynet strideynet commented Jan 28, 2025

Part of https://github.com/gravitational/cloud/issues/11855

As per RFD0166 - https://github.com/gravitational/cloud/pull/11766

Blocked on https://github.com/gravitational/cloud/pull/11852 merging to keep prehog protos in sync.

Example submitted report:

{
  "userActivity": [
    {
      "reportUuid": "Ybg2ByrsRI+wPGupVu7URw==",
      "clusterName": "+ZO2wFwFwUwJY1KktgC1CipsYhhOYFeC5heNuZ+SjeE=",
      "reporterHostid": "71t3oKtnW66IjxoSq13ejal7cR1ycv5tTjGB/Xn4ALk=",
      "startTime": "2025-01-29T13:45:00Z",
      "records": [
        {
          "userName": "8Bq+CCVzADXtgnj30ZNSF/f4uyqaAlFXp1ao5TxWiCU=",
          "userKind": "USER_KIND_BOT",
          "spiffeSvidsIssued": "3",
          "botJoins": "1",
          "certificatesIssued": "4"
        },
        {
          "userName": "5Hq3LdWDOcM6IMkbjjcS9APZD0YWwlW4zViWgKFTEmo=",
          "userKind": "USER_KIND_HUMAN",
          "logins": "1",
          "certificatesIssued": "1"
        }
      ]
    }
  ],
  "resourcePresence": [
    {
      "reportUuid": "sgYcjoR7Rq+KGVvN9Vg+bg==",
      "clusterName": "+ZO2wFwFwUwJY1KktgC1CipsYhhOYFeC5heNuZ+SjeE=",
      "reporterHostid": "71t3oKtnW66IjxoSq13ejal7cR1ycv5tTjGB/Xn4ALk=",
      "startTime": "2025-01-29T13:00:00Z",
      "resourceKindReports": [
        {
          "resourceKind": "RESOURCE_KIND_APP_SERVER",
          "resourceIds": [
            "15992637790899819489"
          ]
        },
        {
          "resourceKind": "RESOURCE_KIND_NODE",
          "resourceIds": [
            "12563749572309375983"
          ]
        }
      ]
    }
  ],
  "botInstanceActivity": [
    {
      "reportUuid": "YJxrZA86SWWQiNIETyzxAg==",
      "clusterName": "+ZO2wFwFwUwJY1KktgC1CipsYhhOYFeC5heNuZ+SjeE=",
      "reporterHostid": "71t3oKtnW66IjxoSq13ejal7cR1ycv5tTjGB/Xn4ALk=",
      "startTime": "2025-01-29T13:00:00Z",
      "records": [
        {
          "botInstanceId": "0hRudVK6RaFWy+omhvmcYICxrCdG4Qrb+llkLB61zos=",
          "botUserName": "8Bq+CCVzADXtgnj30ZNSF/f4uyqaAlFXp1ao5TxWiCU=",
          "botJoins": "1",
          "spiffeSvidsIssued": "3",
          "certificatesIssued": "4"
        }
      ]
    }
  ]
}

Only backporting to v17/v16 as BotInstance functionality is not present in v15.

@strideynet strideynet changed the title Strideynet/bot instance activity Track usage by BotInstanceID Jan 28, 2025
@strideynet strideynet force-pushed the strideynet/bot-instance-activity branch from b3108ed to 3d542ff Compare January 29, 2025 10:23
@strideynet strideynet added do-not-merge backport/branch/v16 backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry labels Jan 29, 2025
@strideynet strideynet marked this pull request as ready for review January 29, 2025 14:56
@strideynet strideynet added this pull request to the merge queue Jan 30, 2025
Merged via the queue into master with commit 9c5f8f7 Jan 30, 2025
46 checks passed
@strideynet strideynet deleted the strideynet/bot-instance-activity branch January 30, 2025 14:19
@public-teleport-github-review-bot

@strideynet See the table below for backport results.

Branch Result
branch/v16 Failed
branch/v17 Failed

strideynet added a commit that referenced this pull request Jan 30, 2025
* Add BotInstanceActivitySupport to usage reporting

* Wire BotInstanceActivityReport into submitter

* Share userActivityLock

* Add test for bot instance

* TestBotInstanceActivityReportSplitting

* Use 15minute interval rather than hourly

* Switch to compound key for botInstanceActivity map

* ADjust lolck name
strideynet added a commit that referenced this pull request Jan 30, 2025
* Add BotInstanceActivitySupport to usage reporting

* Wire BotInstanceActivityReport into submitter

* Share userActivityLock

* Add test for bot instance

* TestBotInstanceActivityReportSplitting

* Use 15minute interval rather than hourly

* Switch to compound key for botInstanceActivity map

* ADjust lolck name
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2025
* Track usage by BotInstanceID (#51540)

* Add BotInstanceActivitySupport to usage reporting

* Wire BotInstanceActivityReport into submitter

* Share userActivityLock

* Add test for bot instance

* TestBotInstanceActivityReportSplitting

* Use 15minute interval rather than hourly

* Switch to compound key for botInstanceActivity map

* ADjust lolck name

* Regen
github-merge-queue bot pushed a commit that referenced this pull request Jan 30, 2025
* Track usage by BotInstanceID (#51540)

* Add BotInstanceActivitySupport to usage reporting

* Wire BotInstanceActivityReport into submitter

* Share userActivityLock

* Add test for bot instance

* TestBotInstanceActivityReportSplitting

* Use 15minute interval rather than hourly

* Switch to compound key for botInstanceActivity map

* ADjust lolck name

* Gen

* Fix backport

* Fix missing Log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/branch/v16 backport/branch/v17 no-changelog Indicates that a PR does not require a changelog entry size/md
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants