question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Refactor command tracking event/context to be initialized earlier

See original GitHub issue

To get things out the door in hurry, the current (although not actually merged yet as of this writing) command tracking events and context are initialized within the cli implementations of those commands. e.g.:

https://github.com/meltano/meltano/blob/762a2592c5da95fa6b1e91aa3c20d79725949a66/src/meltano/cli/invoke.py#L75-L80

But we could (should?) initialize it further up the stack when click is setting up, maybe https://github.com/meltano/meltano/blob/762a2592c5da95fa6b1e91aa3c20d79725949a66/src/meltano/cli/cli.py#L32 ? Then we could also add the global opts like --log-level to the tracking context.

The initialized tracker with appropriate tracking context could then be embedded in the click context (context is suddenly a super loaded term for us), and down stream we could pull the tracker from the click context:

@click.option("--some-option")
@click.pass_context
def some_cli_command(ctx, some_option):
    tracker = ctx.obj["tracker"] 

Related work items

Noted this related issue may be solved at the same time (or not):

If resolved, we can close the other at the same time. If not, we’ll re-raise/re-prioritize that after this closes.

/cc @pnadolny13 @aaronsteers @WillDaSilva

Issue Analytics

  • State:closed
  • Created a year ago
  • Reactions:4
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

3reactions
WillDaSilvacommented, Jun 15, 2022

I’ll note that the simplification isn’t just for the benefit of us Meltano core dev who want “cleaner” code. Any external contributor should be able to add to or edit the Meltano CLI without thinking about telemetry. Making it automatic via a decorator would enable that.

2reactions
pandemicsyncommented, Jun 22, 2022

@aaronsteers @WillDaSilva Ok I have a proposal of how we might do this up in https://github.com/meltano/meltano/pull/6260, It’s still a Draft because it’s just a proposal at this point. Lots of details in the PR body though and example usage in our 3 most common current scenarios. Please let me know what you think over on the PR, and we’ll iterate from there.

@pnadolny13 have one ask for you in the PR. On what you’d like the schema to look like for the cli params I collect. Currently, I’m just using a dict of the keys/values, but could do something more strict if you’d prefer.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nodejs10.x Error: Missing AWS Lambda trace data for X-Ray ...
A fix was to move the captureHTTPsGlobal command inside of the lambda function function handler. Before, it was running from the global ...
Read more >
Tutorial - AWS Lambda Powertools for Python
Let's include Lambda Powertools as a dependency in requirement.txt , and use Event Handler to refactor our previous example. app.py requirements ...
Read more >
Easy Event Tracking Pipeline From Front-end to Redshift
When you setup a Kinesis Firehose, you can choose which Redshift cluster to dump the data into. Provide it with the appropriate COPY...
Read more >
Events API - MoodleDocs
Statically declared in the event class method init(). This tells you if it was a course, activity, course category, etc. User ID, or...
Read more >
Key Java API Components for Custom Channel
... for initalizing, starting, connecting and closing of channels. init; start; connect; close ... Implement the following EventContext interface methods.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found