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

Add java doc based on sentry-data-schemes project #1045

Merged
merged 6 commits into from
Nov 16, 2020
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* Bump: AGP 4.1.1
* Fix: use neutral Locale for String operations #1033
* Update to sentry-native 0.4.4 and fix shared library builds (#1039)
* Added java doc to protocol classes based on sentry-data-schemes project

# 3.1.3

Expand Down
161 changes: 141 additions & 20 deletions sentry/src/main/java/io/sentry/SentryEvent.java
Original file line number Diff line number Diff line change
@@ -1,44 +1,165 @@
package io.sentry;

import io.sentry.protocol.*;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.annotations.TestOnly;

public final class SentryEvent implements IUnknownPropertiesConsumer {
private SentryId eventId;
/**
* Timestamp when the event was created.
*
* <p>Indicates when the event was created in the Sentry SDK. The format is either a string as
* defined in [RFC 3339](https://tools.ietf.org/html/rfc3339) or a numeric (integer or float)
* value representing the number of seconds that have elapsed since the [Unix
* epoch](https://en.wikipedia.org/wiki/Unix_time).
*
* <p>Sub-microsecond precision is not preserved with numeric values due to precision limitations
* with floats (at least in our systems). With that caveat in mind, just send whatever is easiest
* to produce.
*
* <p>All timestamps in the event protocol are formatted this way.
*
* <p>```json { "timestamp": "2011-05-02T17:41:36Z" } { "timestamp": 1304358096.0 } ```
*/
private final Date timestamp;

/**
* Unique identifier of this event.
*
* <p>Hexadecimal string representing a uuid4 value. The length is exactly 32 characters. Dashes
* are not allowed. Has to be lowercase.
*
* <p>Even though this field is backfilled on the server with a new uuid4, it is strongly
* recommended to generate that uuid4 clientside. There are some features like user feedback which
* are easier to implement that way, and debugging in case events get lost in your Sentry
* installation is also easier.
*
* <p>Example:
*
* <p>```json { "event_id": "fc6d8c0c43fc4630ad850ee518f1b9d0" } ```
*/
private SentryId eventId;
/** The captured Throwable */
private transient @Nullable Throwable throwable;

/** Custom parameterized message for this event. */
private Message message;
/**
* Server or device name the event was generated on.
*
* <p>This is supposed to be a hostname.
*/
private String serverName;
/**
* Platform identifier of this event (defaults to "other").
*
* <p>A string representing the platform the SDK is submitting from. This will be used by the
* Sentry interface to customize various components in the interface, but also to enter or skip
* stacktrace processing.
*
* <p>Acceptable values are: `as3`, `c`, `cfml`, `cocoa`, `csharp`, `elixir`, `haskell`, `go`,
* `groovy`, `java`, `javascript`, `native`, `node`, `objc`, `other`, `perl`, `php`, `python`,
* `ruby`
*/
private String platform;
/**
* The release version of the application.
*
* <p>**Release versions must be unique across all projects in your organization.** This value can
* be the git SHA for the given project, or a product identifier with a semantic version.
*/
private String release;
/**
* Program's distribution identifier.
*
* <p>The distribution of the application.
*
* <p>Distributions are used to disambiguate build or deployment variants of the same release of
* an application. For example, the dist can be the build number of an XCode build or the version
* code of an Android build.
*/
private String dist;
/** Logger that created the event. */
private String logger;
/** Threads that were active when the event occurred. */
private SentryValues<SentryThread> threads;
/** One or multiple chained (nested) exceptions. */
private SentryValues<SentryException> exception;
/**
* Severity level of the event. Defaults to `error`.
*
* <p>Example:
*
* <p>```json {"level": "warning"} ```
*/
private SentryLevel level;
/**
* Transaction name of the event.
*
* <p>For example, in a web app, this might be the route name (`"/users/<username>/"` or
* `UserView`), in a task queue it might be the function + module name.
*/
private String transaction;
/**
* The environment name, such as `production` or `staging`.
*
* <p>```json { "environment": "production" } ```
*/
private String environment;
/** Information about the user who triggered this event. */
private User user;
/** Information about a web request that occurred during the event. */
private Request request;
/** Information about the Sentry SDK that generated this event. */
private SdkVersion sdk;
/** Contexts describing the environment (e.g. device, os or browser). */
private Contexts contexts = new Contexts();
/**
* Manual fingerprint override.
*
* <p>A list of strings used to dictate how this event is supposed to be grouped with other events
* into issues. For more information about overriding grouping see [Customize Grouping with
* Fingerprints](https://docs.sentry.io/data-management/event-grouping/).
*
* <p>```json { "fingerprint": ["myrpc", "POST", "/foo.bar"] }
*/
private List<String> fingerprint;
/** List of breadcrumbs recorded before this event. */
private List<Breadcrumb> breadcrumbs;
/**
* Custom tags for this event.
*
* <p>A map or list of tags for this event. Each tag must be less than 200 characters.
*/
private Map<String, String> tags;
/**
* Arbitrary extra information set by the user.
*
* <p>```json { "extra": { "my_key": 1, "some_other_value": "foo bar" } }```
*/
private Map<String, Object> extra;

private Map<String, Object> unknown;
/**
* Name and versions of all installed modules/packages/dependencies in the current
* environment/application.
*
* <p>```json { "django": "3.0.0", "celery": "4.2.1" } ```
*
* <p>In Python this is a list of installed packages as reported by `pkg_resources` together with
* their reported version string.
*
* <p>This is primarily used for suggesting to enable certain SDK integrations from within the UI
* and for making informed decisions on which frameworks to support in future development efforts.
*/
private Map<String, String> modules;
/** Meta data for event processing and debugging. */
private DebugMeta debugMeta;

SentryEvent(SentryId eventId, final Date timestamp) {
Expand Down Expand Up @@ -69,6 +190,10 @@ public SentryId getEventId() {
return eventId;
}

public void setEventId(SentryId eventId) {
this.eventId = eventId;
}

@SuppressWarnings("JdkObsolete")
public Date getTimestamp() {
return (Date) timestamp.clone();
Expand All @@ -83,6 +208,15 @@ public Date getTimestamp() {
return throwable;
}

/**
* Sets the Throwable
*
* @param throwable the Throwable or null
*/
public void setThrowable(final @Nullable Throwable throwable) {
this.throwable = throwable;
}

public Message getMessage() {
return message;
}
Expand Down Expand Up @@ -151,19 +285,6 @@ public void setExceptions(List<SentryException> exception) {
this.exception = new SentryValues<>(exception);
}

public void setEventId(SentryId eventId) {
this.eventId = eventId;
}

/**
* Sets the Throwable
*
* @param throwable the Throwable or null
*/
public void setThrowable(final @Nullable Throwable throwable) {
this.throwable = throwable;
}

public SentryLevel getLevel() {
return level;
}
Expand Down
11 changes: 11 additions & 0 deletions sentry/src/main/java/io/sentry/protocol/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,23 @@
public final class App implements IUnknownPropertiesConsumer, Cloneable {
public static final String TYPE = "app";

/** Version-independent application identifier, often a dotted bundle ID. */
private String appIdentifier;
/**
* Start time of the app.
*
* <p>Formatted UTC timestamp when the user started the application.
*/
private Date appStartTime;
/** Application-specific device identifier. */
private String deviceAppHash;
/** String identifying the kind of build. For example, `testflight`. */
private String buildType;
/** Application name as it appears on the platform. */
private String appName;
/** Application version as it appears on the platform. */
private String appVersion;
/** Internal build ID as it appears on the platform. */
private String appBuild;

@SuppressWarnings("unused")
Expand Down
2 changes: 2 additions & 0 deletions sentry/src/main/java/io/sentry/protocol/Browser.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

public final class Browser implements IUnknownPropertiesConsumer, Cloneable {
public static final String TYPE = "browser";
/** Display name of the browser application. */
private String name;
/** Version string of the browser. */
private String version;

@SuppressWarnings("unused")
Expand Down
Loading