# 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)

*** ** * ** ***

Android/JVM
- android

  ```
  abstract class EventMetadata
  ```

*** ** * ** ***

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

## Summary

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

## Public functions

### addCallStackEntry

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

```
abstract fun addCallStackEntry(name: String, sourceFile: String?, lineNumber: Int): Unit
```

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

### addCategory

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

```
abstract fun addCategory(name: String): Unit
```

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

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

### addCorrelationId

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

```
abstract fun addCorrelationId(id: Long): Unit
```

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

### addCorrelationId

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

```
abstract fun addCorrelationId(id: String): Unit
```

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

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

```
abstract fun addMetadataEntry(name: String, value: Boolean): Unit
```

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

### addMetadataEntry

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

```
abstract fun addMetadataEntry(name: String, value: Double): Unit
```

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

### addMetadataEntry

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

```
abstract fun addMetadataEntry(name: String, value: Long): Unit
```

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

### addMetadataEntry

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

```
abstract fun addMetadataEntry(name: String, value: String): Unit
```

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

### dispatchToTraceSink

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

```
@DelicateTracingApi
abstract fun dispatchToTraceSink(): Unit
```

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