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

Capture endpoint hash for global plugins telemetry #845

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

prkalle
Copy link
Contributor

@prkalle prkalle commented Jan 23, 2025

What this PR does / why we need it

This PR adds changes to capture endpoint hash for global plugins telemetry data.
Since all the tanzu platform plugins are of global target type and operates on tanzu context type, it is reasonable to collect the endpoint hash if the tanzu context is active for all the global plugins telemetry

Which issue(s) this PR fixes

Fixes #

Describe testing done for PR

Verified the global plugins now has the endpoint hash capture if the current active context is of tyep tanzu.
Before the change:

❯ tanzu apps list
Error: No space found in active context of type tanzu. Use the "tanzu space use" command to select one.
❯ sqlite3 -batch /Users/pkalle/.config/tanzu-cli-telemetry/cli_metrics.db  "select * from tanzu_cli_operations;"
cli_version|os_name|os_arch|plugin_name|plugin_version|command|cli_id|command_start_ts|command_end_ts|target|name_arg|endpoint|flags|exit_status|is_internal|error
v1.5.1|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737654457403|1737654457408||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.1|darwin|arm64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737654455543|1737654457985|global|||{"all":""}|0|0|
v1.5.1|darwin|arm64|||plugin list|a736004c-f899-4d21-8605-551fa843ba89|1737670048568|1737670048732|||||0|0|
v1.5.1|darwin|arm64|||plugin install|a736004c-f899-4d21-8605-551fa843ba89|1737670080541|1737670086035||appsv2||{"target":"global"}|0|0|
v1.5.1|darwin|arm64|appsv2|v0.21.2|app|a736004c-f899-4d21-8605-551fa843ba89|1737670090400|1737670090659|global||||2|0|
❯ tanzu role binding list --all
  ID                                    USER/GROUP               ROLE           SCOPE
  0300d31e-8c47-48a1-9c7a-6880a2ebc65d  [email protected]  Administrator  /
  0f2c386a-c69d-4f9b-8673-7fac938edc62  [email protected]  Administrator  /projects/app-management-new
  25028fee-7719-4542-b645-63a8bc78c190  [email protected]  Viewer         /
  37c6918b-408c-4ee0-8b3e-b06bd287975f  [email protected]  Administrator  /projects/tatanas
  45394006-e895-43f6-9be4-08eb359e25d0  [email protected]     Administrator  /projects/anuj-project
  4929c419-9d9d-4121-8ac3-e94463c64cee  [email protected]     Administrator  /projects/tatanas/clustergroups/bobi-autoscale
  526f32fc-9bf3-446a-bca0-7fd533927b40  [email protected]  Administrator  /projects/anuj-project
  5cc7d1e8-5ec1-45e6-ab28-71c6a1777d44  [email protected]     Viewer         /
  7a1dd50f-e6b6-465b-adf6-ba65ad94c2d2  [email protected]     Administrator  /projects/tatanas
  f097e38e-7860-424f-b72b-66b167687204  [email protected]     Administrator  /projects/app-management-new
  f5b2944f-ddaf-4e4e-a0ee-8a6729de0faf  [email protected]  Administrator  /projects/tatanas/clustergroups/bobi-autoscale

❯ sqlite3 -batch /Users/pkalle/.config/tanzu-cli-telemetry/cli_metrics.db  "select * from tanzu_cli_operations;"
cli_version|os_name|os_arch|plugin_name|plugin_version|command|cli_id|command_start_ts|command_end_ts|target|name_arg|endpoint|flags|exit_status|is_internal|error
v1.5.1|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737654457403|1737654457408||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.1|darwin|arm64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737654455543|1737654457985|global|||{"all":""}|0|0|
v1.5.1|darwin|arm64|||plugin list|a736004c-f899-4d21-8605-551fa843ba89|1737670048568|1737670048732|||||0|0|
v1.5.1|darwin|arm64|||plugin install|a736004c-f899-4d21-8605-551fa843ba89|1737670080541|1737670086035||appsv2||{"target":"global"}|0|0|
v1.5.1|darwin|arm64|appsv2|v0.21.2|app|a736004c-f899-4d21-8605-551fa843ba89|1737670090400|1737670090659|global||||2|0|
v1.5.1|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670195004|1737670195627||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.1|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670197005|1737670197009||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.1|darwin|arm64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737670194326|1737670197694|global|||{"all":""}|0|0|
❯

After the change:

❯ ./bin/tanzu role binding list --all
  ID                                    USER/GROUP               ROLE           SCOPE
  0300d31e-8c47-48a1-9c7a-6880a2ebc65d  [email protected]  Administrator  /
  0f2c386a-c69d-4f9b-8673-7fac938edc62  [email protected]  Administrator  /projects/app-management-new
  25028fee-7719-4542-b645-63a8bc78c190  [email protected]  Viewer         /
  37c6918b-408c-4ee0-8b3e-b06bd287975f  [email protected]  Administrator  /projects/tatanas
  45394006-e895-43f6-9be4-08eb359e25d0  [email protected]     Administrator  /projects/anuj-project
  4929c419-9d9d-4121-8ac3-e94463c64cee  [email protected]     Administrator  /projects/tatanas/clustergroups/bobi-autoscale
  526f32fc-9bf3-446a-bca0-7fd533927b40  [email protected]  Administrator  /projects/anuj-project
  5cc7d1e8-5ec1-45e6-ab28-71c6a1777d44  [email protected]     Viewer         /
  7a1dd50f-e6b6-465b-adf6-ba65ad94c2d2  [email protected]     Administrator  /projects/tatanas
  f097e38e-7860-424f-b72b-66b167687204  [email protected]     Administrator  /projects/app-management-new
  f5b2944f-ddaf-4e4e-a0ee-8a6729de0faf  [email protected]  Administrator  /projects/tatanas/clustergroups/bobi-autoscale

❯ sqlite3 -batch /Users/pkalle/.config/tanzu-cli-telemetry/cli_metrics.db  "select * from tanzu_cli_operations;"
cli_version|os_name|os_arch|plugin_name|plugin_version|command|cli_id|command_start_ts|command_end_ts|target|name_arg|endpoint|flags|exit_status|is_internal|error
v1.5.2-alpha.0|darwin|amd64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737670402467|1737670405105|global||tanzu:bb8a938ea5c5c7d5894398fcfe2aa12848d75b521e44ba5eebd6f0363d0ac98b|{"all":""}|0|0|
v1.5.2-alpha.0|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670487436|1737670487440||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.2-alpha.0|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670488287|1737670488294||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.2-alpha.0|darwin|amd64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737670486843|1737670488934|global||tanzu:bb8a938ea5c5c7d5894398fcfe2aa12848d75b521e44ba5eebd6f0363d0ac98b|{"all":""}|0|0|
❯ ./bin/tanzu space list
No Spaces found.

❯ sqlite3 -batch /Users/pkalle/.config/tanzu-cli-telemetry/cli_metrics.db  "select * from tanzu_cli_operations;"
cli_version|os_name|os_arch|plugin_name|plugin_version|command|cli_id|command_start_ts|command_end_ts|target|name_arg|endpoint|flags|exit_status|is_internal|error
v1.5.2-alpha.0|darwin|amd64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737670402467|1737670405105|global||tanzu:bb8a938ea5c5c7d5894398fcfe2aa12848d75b521e44ba5eebd6f0363d0ac98b|{"all":""}|0|0|
v1.5.2-alpha.0|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670487436|1737670487440||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.2-alpha.0|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670488287|1737670488294||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.2-alpha.0|darwin|amd64|rbac|v0.0.0-dev-081e187|role|a736004c-f899-4d21-8605-551fa843ba89|1737670486843|1737670488934|global||tanzu:bb8a938ea5c5c7d5894398fcfe2aa12848d75b521e44ba5eebd6f0363d0ac98b|{"all":""}|0|0|
v1.5.1|darwin|amd64|||context get-token|a736004c-f899-4d21-8605-551fa843ba89|1737670531811|1737670531816||7f32a002d9ba97086d31a6e2c6525ccbe6a2820872411af3e5c4a2b3d17879c1|||0|0|
v1.5.2-alpha.0|darwin|amd64|space|v0.3.0|space list|a736004c-f899-4d21-8605-551fa843ba89|1737670530095|1737670533441|global||tanzu:bb8a938ea5c5c7d5894398fcfe2aa12848d75b521e44ba5eebd6f0363d0ac98b||0|0|

Release note

Capture endpoint hash for global plugins telemetry

Additional information

Special notes for your reviewer

@prkalle prkalle requested a review from a team as a code owner January 23, 2025 22:33
@prkalle prkalle force-pushed the fix/global_tanzu_ep_hash branch from 271425f to b217460 Compare January 23, 2025 23:15
Signed-off-by: Prem Kumar Kalle <[email protected]>
@prkalle prkalle force-pushed the fix/global_tanzu_ep_hash branch from 2ef9e4e to 778c1c8 Compare January 24, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants