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

Document Requests kwargs #679

Merged
merged 3 commits into from
Dec 18, 2024
Merged

Document Requests kwargs #679

merged 3 commits into from
Dec 18, 2024

Conversation

Kludex
Copy link
Member

@Kludex Kludex commented Dec 16, 2024

Should we actually remove the kwargs and use the parameters? It's just a bad experience in every sense to have kwargs.

@Kludex Kludex requested a review from alexmojaki December 16, 2024 11:19
Copy link

cloudflare-workers-and-pages bot commented Dec 16, 2024

Deploying logfire-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6b59d52
Status: ✅  Deploy successful!
Preview URL: https://20c383c5.logfire-docs.pages.dev
Branch Preview URL: https://document-kwargs-celery.logfire-docs.pages.dev

View logs

Copy link
Contributor

@alexmojaki alexmojaki left a comment

Choose a reason for hiding this comment

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

Normal arguments are definitely better. Each integration can also have **kwargs: Any which is documented as something like 'other arguments passed to OTEL, intended for forward compatibility'.

'StructlogProcessor',
'LogfireLoggingHandler',
'loguru_handler',
'SamplingOptions',
'MetricsOptions',
'CeleryInstrumentKwargs',
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should in general avoid adding things to __init__ if they only serve as type hints.

@Kludex Kludex force-pushed the document-kwargs-celery branch from afb3724 to c4a4f03 Compare December 16, 2024 13:05
@Kludex Kludex changed the title Document Celery kwargs Document Requests kwargs Dec 16, 2024
@Kludex Kludex requested a review from alexmojaki December 16, 2024 13:09
@Kludex
Copy link
Member Author

Kludex commented Dec 16, 2024

@alexmojaki please confirm if this is okay for you. If it's, I'll add the others.

Copy link

codecov bot commented Dec 16, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (2ef9725) to head (6b59d52).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #679   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          137       137           
  Lines        10919     10920    +1     
  Branches      1520      1520           
=========================================
+ Hits         10919     10920    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Contributor

@alexmojaki alexmojaki left a comment

Choose a reason for hiding this comment

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

Yes, this approach looks good

@@ -1174,17 +1174,26 @@ def instrument_httpx(
self._warn_if_not_initialized_for_instrumentation()
return instrument_httpx(self, client, **kwargs)

def instrument_celery(self, **kwargs: Unpack[CeleryInstrumentKwargs]) -> None:
def instrument_celery(self, **kwargs: Any) -> None:
Copy link
Contributor

Choose a reason for hiding this comment

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

What about skip_dep_check?

Copy link
Member Author

Choose a reason for hiding this comment

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

I removed on purpose. Is it really important? People shouldn't use it anyway... Unless specific cases like psycopg-binary...

Copy link
Contributor

@alexmojaki alexmojaki Dec 18, 2024

Choose a reason for hiding this comment

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

No it's not that important but I wasn't sure if it was intentional. Let's leave it out.

def instrument_requests(
self,
excluded_urls: str | None = None,
request_hook: Callable[[Span, requests.PreparedRequest], None] | None = None,
Copy link
Contributor

Choose a reason for hiding this comment

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

Nice of otel to pass the actual request object this time lol

@Kludex Kludex requested a review from alexmojaki December 18, 2024 10:20
@Kludex
Copy link
Member Author

Kludex commented Dec 18, 2024

let me know if this is okay, and I'll apply to the others.

@Kludex Kludex force-pushed the document-kwargs-celery branch from c4bc011 to e4ce95e Compare December 18, 2024 10:25
@Kludex Kludex force-pushed the document-kwargs-celery branch from e4ce95e to 6b59d52 Compare December 18, 2024 10:25
@Kludex Kludex merged commit 7e6b140 into main Dec 18, 2024
12 checks passed
@Kludex Kludex deleted the document-kwargs-celery branch December 18, 2024 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants