# EventMetadata

Artifact: [androidx.tracing:tracing](https://developer.android.com/jetpack/androidx/releases/tracing) [View Source](https://cs.android.com/search?q=file:androidx/tracing/EventMetadata.kt+class:androidx.tracing.EventMetadata) Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

*** ** * ** ***


```
public abstract class EventMetadata
```

<br />

*** ** * ** ***

Makes it possible to associate debug metadata \& categories to a `https://developer.android.com/reference/androidx/tracing/TraceEvent`. Typically obtained by a call to `https://developer.android.com/reference/androidx/tracing/Tracer#beginSectionWithMetadata(kotlin.String,kotlin.String,androidx.tracing.PropagationToken,kotlin.Boolean)`.

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addCallStackEntry(kotlin.String,kotlin.String,kotlin.Int)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, https://developer.android.com/reference/java/lang/String.html sourceFile, int lineNumber)` Adds call stack frame information to the `https://developer.android.com/reference/androidx/tracing/TraceEvent`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addCategory(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name)` Adds additional categories to the `https://developer.android.com/reference/androidx/tracing/TraceEvent`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addCorrelationId(kotlin.Long)(long id)` Add a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` correlation id to the trace packet. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addCorrelationId(kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html id)` Adds a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` correlation id to the trace packet. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Boolean)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, boolean value)` Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Boolean)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Double)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, double value)` Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Double)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Long)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, long value)` Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Long)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`. |
| `abstract void` | `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.String)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html name, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html value)` Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.String)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html`. |
| `abstract void` | `@https://developer.android.com/reference/androidx/tracing/DelicateTracingApi https://developer.android.com/reference/androidx/tracing/EventMetadata#dispatchToTraceSink()()` Dispatches the underlying `https://developer.android.com/reference/androidx/tracing/TraceEvent` to the `https://developer.android.com/reference/androidx/tracing/AbstractTraceSink` instance if applicable. |

## Public methods

### addCallStackEntry

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addCallStackEntry(@NonNull String name, String sourceFile, int lineNumber)
```

Adds call stack frame information to the `https://developer.android.com/reference/androidx/tracing/TraceEvent`.

### addCategory

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addCategory(@NonNull String name)
```

Adds additional categories to the `https://developer.android.com/reference/androidx/tracing/TraceEvent`.

This is useful when an application is interested in a subset of `https://developer.android.com/reference/androidx/tracing/TraceEvent`s that belong to well known categories. These are typically small identifiers useful for namespacing `https://developer.android.com/reference/androidx/tracing/TraceEvent`s.

### addCorrelationId

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addCorrelationId(long id)
```

Add a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html` correlation id to the trace packet.

### addCorrelationId

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addCorrelationId(@NonNull String id)
```

Adds a `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html` correlation id to the trace packet.

Consider using the `addCorrelationId(Long)` variant for performance reasons when possible.

### addMetadataEntry

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addMetadataEntry(@NonNull String name, boolean value)
```

Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Boolean)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html`.

### addMetadataEntry

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addMetadataEntry(@NonNull String name, double value)
```

Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Double)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-double/index.html`.

### addMetadataEntry

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addMetadataEntry(@NonNull String name, long value)
```

Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.Long)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-long/index.html`.

### addMetadataEntry

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
public abstract void addMetadataEntry(@NonNull String name, @NonNull String value)
```

Adds a metadata entry where the type of the `https://developer.android.com/reference/androidx/tracing/EventMetadata#addMetadataEntry(kotlin.String,kotlin.String)` is an `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html`.

### dispatchToTraceSink

Added in [2.0.5](https://developer.android.com/jetpack/androidx/releases/tracing#2.0.5)

```
@DelicateTracingApi
public abstract void dispatchToTraceSink()
```

Dispatches the underlying `https://developer.android.com/reference/androidx/tracing/TraceEvent` to the `https://developer.android.com/reference/androidx/tracing/AbstractTraceSink` instance if applicable.