Add Collector name and version to Analytics API payload#13
Conversation
c646a04 to
4dcfad8
Compare
| from uuid import uuid4 | ||
|
|
||
| import os | ||
| from .constants import COLLECTOR_NAME, VERSION # pylint: disable=W0611 |
There was a problem hiding this comment.
Python linter doesn't recognise that imports that are interpolated are actually used, so disabling for this line
https://pylint.pycqa.org/en/latest/user_guide/messages/warning/unused-import.html
| "message": self.message, | ||
| "url": self.url | ||
| "url": self.url, | ||
| "collector": 'python-{COLLECTOR_NAME}', |
There was a problem hiding this comment.
I don't think I should be changing gem/package/library name in the setup.py, so I have instead added collector type clarity here by interpolating the language before the generic name (buildkite-test-collector is the same as the exlir and ruby collector names. The JS collector follows this pattern of interpolation the package name with the language).
gchan
left a comment
There was a problem hiding this comment.
Code changes LGTM! I haven't tested or verified it works.
Can we update/add a test to verify the collector name and version is what we expect?
Maybe here (or another appropriate place)? https://github.com/buildkite/test-collector-python/blob/main/tests/buildkite_test_collector/collector/test_run_env.py#L32
cf57433 to
30d9932
Compare
…payload to contain this data
30d9932 to
3ee08a7
Compare
Cool, have added - I really don't know how to test this as I also need to bump the package in another PR (I think). @swebb do you know? |
|
Hi @KatieWright26. Good to see you! :) |
Jimsy!! I saw your last name and couldn't remember if it was yours! Tiny NZ tech scene strikes again 😆 |
TA is working on displaying a tally of the types of collectors our customers are using. We can gather this data via the collector names and versions, however some collectors are missing this data (please see related linear ticket for list).
As I am unfamilar with python, I moved the NAME and VERSION values from the
setup.pyand defined them in a new fileconstants.py. This way we can share these values across file names while keeping them consistent. Happy to change if a Python speaker knows better!This PR does not include the necessary version bump + publish to Python Package Index.
This collector will now emit the collector name "python-buildkite-test-collector"
Linear Ticket
Related Linear Ticket