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 Analytics for custom components #8130

Merged
merged 5 commits into from
Apr 25, 2024
Merged

Conversation

freddyaboulton
Copy link
Collaborator

Description

Closes: #7330

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Apr 25, 2024

🪼 branch checks and previews

Name Status URL
Spaces ready! Spaces preview
Website ready! Website preview
🦄 Changes detected! Details

Install Gradio from this PR

pip install https://gradio-builds.s3.amazonaws.com/7b511c1234d5b91b268f3ff59c97d09daaefc449/gradio-4.27.0-py3-none-any.whl

Install Gradio Python Client from this PR

pip install "gradio-client @ git+https://github.com/gradio-app/gradio@7b511c1234d5b91b268f3ff59c97d09daaefc449#subdirectory=client/python"

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Apr 25, 2024

🦄 change detected

This Pull Request includes changes to the following packages.

Package Version
gradio patch
  • Maintainers can select this checkbox to manually select packages to update.

With the following changelog entry.

Add Analytics for custom components

Maintainers or the PR author can modify the PR title to modify this entry.

Something isn't right?

  • Maintainers can change the version label to modify the version bump.
  • If the bot has failed to detect any changes, or if this pull request needs to update multiple packages to different versions or requires a more comprehensive changelog entry, maintainers can update the changelog file directly.

@freddyaboulton freddyaboulton added the v: patch A change that requires a patch release label Apr 25, 2024
]
outputs_telemetry = outputs_telemetry + [
str(blocks.blocks[y]) for y in x.outputs if y in blocks.blocks
blocks.blocks[y].get_block_name() for y in x.outputs if y in blocks.blocks
Copy link
Collaborator

Choose a reason for hiding this comment

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

does get_block_name return a string different from before? If so, when comparing analytics this could break things

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Before we were doing the wrong thing imo. We were storing the full class path <gradio.components.textbox.Textbox object at 0x11c035790>.

Change introduced in this PR: #7712 probably

Copy link
Collaborator

Choose a reason for hiding this comment

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

This fix makes sense. We'll probably have to update the kibana dashboard for how we filter input/output components

Copy link
Member

@abidlabs abidlabs Apr 25, 2024

Choose a reason for hiding this comment

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

Yes my bad about that change. This is the better approach and reverts back to just storing the string names (so we shouldn't have to make changes to Kibana)

x, BlockContext
) else blocks_telemetry.append(str(x))

blocks_telemetry.append(x.get_block_name())
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We were saving the string repr of the instance as opposed to the name, e.g. <gradio.components.textbox.Textbox object at 0x11c035790>

@freddyaboulton freddyaboulton marked this pull request as ready for review April 25, 2024 17:09
Comment on lines 235 to 246
def custom_component_analytics(
command: str,
template: str | None,
upload_pypi: bool | None,
upload_demo: bool | None,
upload_source: bool | None,
generate_docs: bool | None = None,
bump_version: bool | None = None,
) -> None:
Copy link
Member

Choose a reason for hiding this comment

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

Do you think it would be worth capturing the arguments being used (as a list) but maybe not the value. Then we could see if people are customising extensively or not?

Copy link
Member

@pngwn pngwn left a comment

Choose a reason for hiding this comment

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

look great. Thanks @freddyaboulton! This will be super useful.

Just left a small question.

@abidlabs
Copy link
Member

Everything looks good to me @freddyaboulton! Just about to review the companion PR on the server

@freddyaboulton freddyaboulton force-pushed the custom-component-analytics branch from e53f5e2 to 14f146b Compare April 25, 2024 20:27
@freddyaboulton freddyaboulton enabled auto-merge (squash) April 25, 2024 20:44
@freddyaboulton freddyaboulton merged commit 0efd72e into main Apr 25, 2024
7 checks passed
@freddyaboulton freddyaboulton deleted the custom-component-analytics branch April 25, 2024 20:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v: patch A change that requires a patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add analytics for custom components workflow
5 participants