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.

`SentryEvent#getExtras` is package-private.

See original GitHub issue

Platform:

  • Android -> If yes, which Device API (and compileSdkVersion/targetSdkVersion/Build tools) version? Device API: 26 compileSdkVersion: 30 targetSdkVersion: 30 buildTools: applied by Android Gradle Plugin

IDE:

  • Android Studio -> If yes, which version? 4.2 beta 3

Build system:

  • Gradle -> If yes, which version? 6.7.1

Android Gradle Plugin:

  • Yes -> If yes, which version? 4.2.0-beta03

Sentry Android Gradle Plugin:

  • No

Proguard/R8:

  • Disabled

Platform installed with:

  • Maven Central

The version of the SDK: 4.3.0


I have the following issue:

I’m writing a library that proxies Sentry. One of the use cases we have is to provide a callback to the library client before sending a SentryEvent. In this callback we’d like to attach all SentryEvent’s extras so the client can decide what to do: add some new extras, update or existing ones.

As Sentry doesn’t allow us to get all extras (only a single extra for key), I can’t see a way to implement our use case.

Would you consider making SentryEvent#getExtras a public method?

Actual result:

  • SentryEvent#getExtras is package-private

Expected result:

  • SentryEvent#getExtras is public

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:9 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
marandanetocommented, Apr 27, 2021

we made package-private because our public API already exposes a setter with key/value and a remove method with key, for every Map, so we don’t expose the field with a getter.

@maciejwalkowiak option of exposing the getter but returning an immutable copy was an option at that time, but we preferred to follow the other SDKs which is not exposing at all, I like this idea to be honest

1reaction
maciejwalkowiakcommented, Apr 9, 2021

The alternative would be to make getExtras public and return a copy of the map, but same pattern would have to be applied in other places in the SDK too.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issues - GitHub
Currently the only usage of getTags / getExtras is sentry-java that I can see is in ContextBuilderHelper.helpBuildingEvent where it is used ...
Read more >
io.sentry.event.Event Maven / Gradle / Ivy - Download JAR files
The class is part of the package ➦ Group: io.sentry ➦ Artifact: sentry ... public class Event implements Serializable { private static final...
Read more >
io.sentry.event.Event.setSentryInterfaces java code examples ...
Ensures that every field in the {@code Event} are immutable to avoid confusion later. */ private void makeImmutable() { // Make the tags...
Read more >
Retrieve an Event for a Project - Sentry Documentation
Product documentation for Sentry.io and its SDKs. ... GET /api/0/projects/{organization_slug}/{project_slug}/events/{event_id}/.
Read more >
EventBuilder.java - 4949.apk源代码分析 - 摸瓜
package io.sentry.event; ... private static final HostnameCache HOSTNAME_CACHE = new HostnameCache(HOSTNAME_CACHE_DURATION); ... getExtra().put(str, obj);.
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