# WorkMetricsQuery

Artifact: [androidx.work:work-analytics](https://developer.android.com/jetpack/androidx/releases/work) [View Source](https://cs.android.com/search?q=file:androidx/work/analytics/WorkMetricsQuery.kt+class:androidx.work.analytics.WorkMetricsQuery) Added in [2.12.0](https://developer.android.com/jetpack/androidx/releases/work#2.12.0)

*** ** * ** ***


```
@ExperimentalWorkMetricsApi
public final class WorkMetricsQuery
```

<br />

*** ** * ** ***

A specification for querying `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsInfo`s.

Each component in a `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery` is `AND`-ed with the others. Each value in a component is `OR`-ed.

## Summary

| ### Nested types |
|---|
| `public final class https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery.Builder` A builder for `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery`. |

| ### Public methods |
|---|---|
| `final long` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getBeginTimeMillis()()` The start of the enqueue time range filter (inclusive), in milliseconds since epoch (e.g. `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()`). |
| `final long` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getEndTimeMillis()()` The end of the enqueue time range filter (inclusive), in milliseconds since epoch (e.g. `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()`). |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/work/analytics/WorkMetricsInfo.State>` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getStates()()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsInfo.State`s being queried. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getTags()()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of tags being queried. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/UUID.html>` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getWorkIds()()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/work/WorkRequest` ids being queried. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/List.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/String.html>` | `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsQuery#getWorkerClassNames()()` The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of worker class names being queried. |

## Public methods

### getBeginTimeMillis

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

```
public final long getBeginTimeMillis()
```

The start of the enqueue time range filter (inclusive), in milliseconds since epoch (e.g. `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()`).

### getEndTimeMillis

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

```
public final long getEndTimeMillis()
```

The end of the enqueue time range filter (inclusive), in milliseconds since epoch (e.g. `https://developer.android.com/reference/java/lang/System.html#currentTimeMillis()`).

### getStates

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

```
public final @NonNull List<@NonNull WorkMetricsInfo.State> getStates()
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/work/analytics/WorkMetricsInfo.State`s being queried.

### getTags

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

```
public final @NonNull List<@NonNull String> getTags()
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of tags being queried.

### getWorkIds

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

```
public final @NonNull List<@NonNull UUID> getWorkIds()
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of `https://developer.android.com/reference/androidx/work/WorkRequest` ids being queried.

### getWorkerClassNames

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

```
public final @NonNull List<@NonNull String> getWorkerClassNames()
```

The `https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html` of worker class names being queried.