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

Allow setting sdk_name at runtime #834

Merged
merged 11 commits into from
Apr 28, 2023
Merged

Allow setting sdk_name at runtime #834

merged 11 commits into from
Apr 28, 2023

Conversation

markushi
Copy link
Member

@markushi markushi commented Apr 21, 2023

Allows setting a custom sdk_name.

This is useful for hybrid SDK which do not compile their own version of sentry_native (E.g. Dart/Flutter re-uses the pre-compiled Android NDK version).

Fixes: #821

@github-actions
Copy link

github-actions bot commented Apr 21, 2023

Messages
📖 Do not forget to update Sentry-docs with your feature once the pull request gets approved.

Generated by 🚫 dangerJS against 97b6bfc

@marandaneto
Copy link
Contributor

@markushi how can we help to unblock this?

@markushi
Copy link
Member Author

@markushi how can we help to unblock this?

@marandaneto No all good, I was just waiting for #827 to be merged, as it changes all public API with string args.

@markushi markushi marked this pull request as ready for review April 26, 2023 08:28
Copy link
Collaborator

@supervacuus supervacuus left a comment

Choose a reason for hiding this comment

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

Looks good, but a couple of issues regarding options-initialization need to be fixed first.

src/sentry_scope.c Show resolved Hide resolved
h->value = sentry__dsn_get_auth_header(dsn);
SENTRY_WITH_OPTIONS (options) {
h->value = sentry__dsn_get_auth_header(dsn, options->user_agent);
}

Copy link
Collaborator

Choose a reason for hiding this comment

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

Same as with options in the scope-private get_client_sdk... I would provide a fallback (even though, in this case, this is less probable to happen before the options have been initialized). But maybe we can shift the options access to sentry__curl_transport_start and add a user_agent field to curl_transport_state_s?

Copy link
Collaborator

Choose a reason for hiding this comment

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

The fact that no unit-test screams at this is also problematic. Can you please add assertions for "user-agent" in the unit tests that "cover" sentry__prepare_http_request()? Thx!

@@ -0,0 +1,65 @@
#include "sentry_options.h"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Most sentry_options_* tests are in test_basic.c, but I have no problems with a file focusing explicitly on option initialization.

tests/unit/test_options.c Show resolved Hide resolved
tests/unit/test_options.c Outdated Show resolved Hide resolved
@markushi markushi merged commit daf2d1c into master Apr 28, 2023
@markushi markushi deleted the feat/custom_sdk_name branch April 28, 2023 07:02
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.

Allow changing SENTRY_SDK_NAME at runtime
3 participants