Package io.sentry

Class Breadcrumb

java.lang.Object
io.sentry.Breadcrumb
All Implemented Interfaces:
JsonSerializable, JsonUnknown

public final class Breadcrumb extends Object implements JsonUnknown, JsonSerializable
Series of application events
  • Constructor Details

    • Breadcrumb

      public Breadcrumb(@NotNull @NotNull Date timestamp)
      Breadcrumb ctor
      Parameters:
      timestamp - the timestamp
    • Breadcrumb

      public Breadcrumb(long timestamp)
    • Breadcrumb

      public Breadcrumb()
      Breadcrumb ctor
    • Breadcrumb

      public Breadcrumb(@Nullable @Nullable String message)
      Breadcrumb ctor
      Parameters:
      message - the message
  • Method Details

    • fromMap

      public static Breadcrumb fromMap(@NotNull @NotNull Map<String,Object> map, @NotNull @NotNull SentryOptions options)
      Creates breadcrumb from a map.
      Parameters:
      map - - The breadcrumb data as map
      options - - the sentry options
      Returns:
      the breadcrumb
    • http

      @NotNull public static @NotNull Breadcrumb http(@NotNull @NotNull String url, @NotNull @NotNull String method)
      Creates HTTP breadcrumb.
      Parameters:
      url - - the request URL
      method - - the request method
      Returns:
      the breadcrumb
    • http

      @NotNull public static @NotNull Breadcrumb http(@NotNull @NotNull String url, @NotNull @NotNull String method, @Nullable @Nullable Integer code)
      Creates HTTP breadcrumb.
      Parameters:
      url - - the request URL
      method - - the request method
      code - - the code result. Code can be null when http request did not finish or ended with network error
      Returns:
      the breadcrumb
    • graphqlOperation

      @NotNull public static @NotNull Breadcrumb graphqlOperation(@Nullable @Nullable String operationName, @Nullable @Nullable String operationType, @Nullable @Nullable String operationId)
      Creates a breadcrumb for a GraphQL operation.
      Parameters:
      operationName - - the name of the GraphQL operation
      operationType - - the type of GraphQL operation (e.g. query, mutation, subscription)
      operationId - - the ID of the GraphQL operation
      Returns:
      the breadcrumb
    • graphqlDataFetcher

      @NotNull public static @NotNull Breadcrumb graphqlDataFetcher(@Nullable @Nullable String path, @Nullable @Nullable String field, @Nullable @Nullable String type, @Nullable @Nullable String objectType)
      Creates a breadcrumb for a GraphQL data fetcher.
      Parameters:
      path - - the name of the GraphQL operation
      field - - the field being fetched
      type - - the type being fetched
      objectType - - the object type of the GraphQL data fetch operation
      Returns:
      the breadcrumb
    • graphqlDataLoader

      @NotNull public static @NotNull Breadcrumb graphqlDataLoader(@NotNull @NotNull Iterable<?> keys, @Nullable @Nullable Class<?> keyType, @Nullable @Nullable Class<?> valueType, @Nullable @Nullable String name)
      Creates a breadcrumb for a GraphQL data loader.
      Parameters:
      keys - - keys to be fetched by the data loader
      keyType - - class of the data loaders key(s)
      valueType - - class of the data loaders value(s)
      name - - name of the data loader
      Returns:
      the breadcrumb
    • transaction

      @NotNull public static @NotNull Breadcrumb transaction(@NotNull @NotNull String message)
      Creates transaction breadcrumb - describing a tracing event.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • debug

      @NotNull public static @NotNull Breadcrumb debug(@NotNull @NotNull String message)
      Creates debug breadcrumb - typically a log message. The data part is entirely undefined and as such, completely rendered as a key/value table.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • error

      @NotNull public static @NotNull Breadcrumb error(@NotNull @NotNull String message)
      Creates error breadcrumb.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • info

      @NotNull public static @NotNull Breadcrumb info(@NotNull @NotNull String message)
      Creates info breadcrumb - information that helps identify the root cause of the issue or for whom the error occurred.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • query

      @NotNull public static @NotNull Breadcrumb query(@NotNull @NotNull String message)
      Creates query breadcrumb - representing a query that was made in your application.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • ui

      @NotNull public static @NotNull Breadcrumb ui(@NotNull @NotNull String category, @NotNull @NotNull String message)
      Creates ui breadcrumb - a user interaction with your app's UI.
      Parameters:
      category - - the category, for example "click"
      message - - the message
      Returns:
      the breadcrumb
    • user

      @NotNull public static @NotNull Breadcrumb user(@NotNull @NotNull String category, @NotNull @NotNull String message)
      Creates user breadcrumb - a user interaction with your app's UI.
      Parameters:
      message - - the message
      Returns:
      the breadcrumb
    • userInteraction

      @NotNull public static @NotNull Breadcrumb userInteraction(@NotNull @NotNull String subCategory, @Nullable @Nullable String viewId, @Nullable @Nullable String viewClass)
      Creates user breadcrumb - a user interaction with your app's UI. The breadcrumb can contain additional data like viewId or viewClass. By default, the breadcrumb is captured with SentryLevel INFO level.
      Parameters:
      subCategory - - the category, for example "click"
      viewId - - the human-readable view id, for example "button_load"
      viewClass - - the fully qualified class name, for example "android.widget.Button"
      Returns:
      the breadcrumb
    • userInteraction

      @NotNull public static @NotNull Breadcrumb userInteraction(@NotNull @NotNull String subCategory, @Nullable @Nullable String viewId, @Nullable @Nullable String viewClass, @Nullable @Nullable String viewTag, @NotNull @NotNull Map<String,Object> additionalData)
      Creates user breadcrumb - a user interaction with your app's UI. The breadcrumb can contain additional data like viewId or viewClass. By default, the breadcrumb is captured with SentryLevel INFO level.
      Parameters:
      subCategory - - the category, for example "click"
      viewId - - the human-readable view id, for example "button_load"
      viewClass - - the fully qualified class name, for example "android.widget.Button"
      viewTag - - the custom tag of the view, for example "button_launch_rocket"
      additionalData - - additional properties to be put into the data bag
      Returns:
      the breadcrumb
    • userInteraction

      @NotNull public static @NotNull Breadcrumb userInteraction(@NotNull @NotNull String subCategory, @Nullable @Nullable String viewId, @Nullable @Nullable String viewClass, @NotNull @NotNull Map<String,Object> additionalData)
      Creates user breadcrumb - a user interaction with your app's UI. The breadcrumb can contain additional data like viewId or viewClass. By default, the breadcrumb is captured with SentryLevel INFO level.
      Parameters:
      subCategory - - the category, for example "click"
      viewId - - the human-readable view id, for example "button_load"
      viewClass - - the fully qualified class name, for example "android.widget.Button"
      additionalData - - additional properties to be put into the data bag
      Returns:
      the breadcrumb
    • getTimestamp

      @NotNull public @NotNull Date getTimestamp()
      Returns the Breadcrumb's timestamp as java.util.Date
      Returns:
      the timestamp
    • getMessage

      @Nullable public @Nullable String getMessage()
      Returns the message
      Returns:
      the message
    • setMessage

      public void setMessage(@Nullable @Nullable String message)
      Sets the message
      Parameters:
      message - the message
    • getType

      @Nullable public @Nullable String getType()
      Returns the type
      Returns:
      the type
    • setType

      public void setType(@Nullable @Nullable String type)
      Sets the type
      Parameters:
      type - the type
    • getData

      @Internal @NotNull public @NotNull Map<String,Object> getData()
      Returns the data map
      Returns:
      the data map
    • getData

      @Nullable public @Nullable Object getData(@NotNull @NotNull String key)
      Returns the value of data[key] or null
      Parameters:
      key - the key
      Returns:
      the value or null
    • setData

      public void setData(@NotNull @NotNull String key, @NotNull @NotNull Object value)
      Sets an entry to the data's map
      Parameters:
      key - the key
      value - the value
    • removeData

      public void removeData(@NotNull @NotNull String key)
      Removes an entry from the data's map
      Parameters:
      key - the key
    • getCategory

      @Nullable public @Nullable String getCategory()
      Returns the category
      Returns:
      the category
    • setCategory

      public void setCategory(@Nullable @Nullable String category)
      Sets the category
      Parameters:
      category - the category
    • getOrigin

      @Nullable public @Nullable String getOrigin()
      Returns the origin
      Returns:
      the origin
    • setOrigin

      public void setOrigin(@Nullable @Nullable String origin)
      Sets the origin
      Parameters:
      origin - the origin
    • getLevel

      @Nullable public @Nullable SentryLevel getLevel()
      Returns the SentryLevel
      Returns:
      the level
    • setLevel

      public void setLevel(@Nullable @Nullable SentryLevel level)
      Sets the level
      Parameters:
      level - the level
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getUnknown

      @Nullable public @Nullable Map<String,Object> getUnknown()
      Specified by:
      getUnknown in interface JsonUnknown
    • setUnknown

      public void setUnknown(@Nullable @Nullable Map<String,Object> unknown)
      Specified by:
      setUnknown in interface JsonUnknown
    • serialize

      public void serialize(@NotNull @NotNull ObjectWriter writer, @NotNull @NotNull ILogger logger) throws IOException
      Specified by:
      serialize in interface JsonSerializable
      Throws:
      IOException