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

Extend Envelope API to get item count, specific items #1038

Open
mitchellh opened this issue Aug 29, 2024 · 4 comments
Open

Extend Envelope API to get item count, specific items #1038

mitchellh opened this issue Aug 29, 2024 · 4 comments
Labels

Comments

@mitchellh
Copy link

In my use case, I'd like to filter envelopes in my transport depending on what is included in them (specifically, I only care about crashes). The envelope API as is is too limited to do this but I can see the envelope structure internally already easily has access to all the information I need. What I'd like to propose:

SENTRY_API size_t sentry_envelope_get_items_count(
    const sentry_envelope_t *envelope);

SENTRY_API sentry_value_t sentry_envelope_get_item_event(
    const sentry_envelope_t *envelope,
    size_t index,
);

SENTRY_API sentry_value_t sentry_envelope_get_item_headers(
    const sentry_envelope_t *envelope,
    size_t index,
);

I'd also be happy with making a new opaque sentry_envelope_item_t and building an API around that...

@mitchellh
Copy link
Author

I just noticed the internal API has something very close to what I'd love to have exposed publicly:

// these for now are only needed for tests
#ifdef SENTRY_UNITTEST
size_t sentry__envelope_get_item_count(const sentry_envelope_t *envelope);
const sentry_envelope_item_t *sentry__envelope_get_item(
    const sentry_envelope_t *envelope, size_t idx);
sentry_value_t sentry__envelope_item_get_header(
    const sentry_envelope_item_t *item, const char *key);
const char *sentry__envelope_item_get_payload(
    const sentry_envelope_item_t *item, size_t *payload_len_out);
#endif

@kahest
Copy link
Member

kahest commented Aug 30, 2024

Hey @mitchellh thanks for the suggestion. We think this makes sense and we'll likely open this API up for the next release.

@kahest kahest moved this from Needs Discussion to Todo in Mobile & Cross Platform SDK Aug 30, 2024
@JoshuaMoelans
Copy link
Member

Hi @mitchellh , are you still interested in these API functionalities? If so, I'll open up a PR.

@mitchellh
Copy link
Author

Hi @JoshuaMoelans, my immediate need for it went away.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Status: Backlog
Development

No branches or pull requests

4 participants