Skip to content

Commit

Permalink
feat(performance): add missing methods (#505)
Browse files Browse the repository at this point in the history
Add method definitions.
  • Loading branch information
ebarooni committed Dec 6, 2024
1 parent 069edf3 commit 67c0f3a
Show file tree
Hide file tree
Showing 2 changed files with 397 additions and 0 deletions.
213 changes: 213 additions & 0 deletions packages/performance/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,15 @@ const isEnabled = async () => {
* [`incrementMetric(...)`](#incrementmetric)
* [`setEnabled(...)`](#setenabled)
* [`isEnabled()`](#isenabled)
* [`putAttribute(...)`](#putattribute)
* [`getAttribute(...)`](#getattribute)
* [`getAttributes(...)`](#getattributes)
* [`removeAttribute(...)`](#removeattribute)
* [`putMetric(...)`](#putmetric)
* [`getMetric(...)`](#getmetric)
* [`record(...)`](#record)
* [Interfaces](#interfaces)
* [Type Aliases](#type-aliases)

</docgen-index>

Expand Down Expand Up @@ -160,6 +168,131 @@ Determines whether performance monitoring is enabled or disabled.
--------------------


### putAttribute(...)

```typescript
putAttribute(options: PutAttributeOptions) => Promise<void>
```

Sets a custom attribute of a trace to a given value.

| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** | <code><a href="#putattributeoptions">PutAttributeOptions</a></code> |

**Since:** 6.3.0

--------------------


### getAttribute(...)

```typescript
getAttribute(options: GetAttributeOptions) => Promise<GetAttributeResult>
```

Returns the value of a custom attribute of a trace.

| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** | <code><a href="#getattributeoptions">GetAttributeOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#getattributeresult">GetAttributeResult</a>&gt;</code>

**Since:** 6.3.0

--------------------


### getAttributes(...)

```typescript
getAttributes(options: GetAttributesOptions) => Promise<GetAttributesResult>
```

Gets the all the custom attributes of a trace with their values.

| Param | Type |
| ------------- | --------------------------------------------------------------------- |
| **`options`** | <code><a href="#getattributesoptions">GetAttributesOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#getattributesresult">GetAttributesResult</a>&gt;</code>

**Since:** 6.3.0

--------------------


### removeAttribute(...)

```typescript
removeAttribute(options: RemoveAttributeOptions) => Promise<void>
```

Removes a custom attribute from a trace given its name.

| Param | Type |
| ------------- | ------------------------------------------------------------------- |
| **`options`** | <code><a href="#getattributeoptions">GetAttributeOptions</a></code> |

**Since:** 6.3.0

--------------------


### putMetric(...)

```typescript
putMetric(options: PutMetricOptions) => Promise<void>
```

Sets the value of a custom metric.

| Param | Type |
| ------------- | ------------------------------------------------------------- |
| **`options`** | <code><a href="#putmetricoptions">PutMetricOptions</a></code> |

**Since:** 6.3.0

--------------------


### getMetric(...)

```typescript
getMetric(options: GetMetricOptions) => Promise<GetMetricResult>
```

Get the value of a custom metric by name.

| Param | Type |
| ------------- | ------------------------------------------------------------- |
| **`options`** | <code><a href="#getmetricoptions">GetMetricOptions</a></code> |

**Returns:** <code>Promise&lt;<a href="#getmetricresult">GetMetricResult</a>&gt;</code>

**Since:** 6.3.0

--------------------


### record(...)

```typescript
record(options: RecordOptions) => Promise<void>
```

Records a trace given its name and options.

| Param | Type |
| ------------- | ------------------------------------------------------- |
| **`options`** | <code><a href="#recordoptions">RecordOptions</a></code> |

**Since:** 6.3.0

--------------------


### Interfaces


Expand Down Expand Up @@ -199,6 +332,86 @@ Determines whether performance monitoring is enabled or disabled.
| ------------- | -------------------- | --------------------------------------------------------------- | ----- |
| **`enabled`** | <code>boolean</code> | `true` if performance monitoring is enabled, otherwise `false`. | 0.1.0 |


#### PutAttributeOptions

| Prop | Type | Description | Since |
| --------------- | ------------------- | --------------------------------------- | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to set its attribute. | 6.3.0 |
| **`attribute`** | <code>string</code> | Name of the attribute to set its value. | 6.3.0 |
| **`value`** | <code>string</code> | The value to set to the attribute. | 6.3.0 |


#### GetAttributeResult

| Prop | Type | Description | Since |
| ----------- | --------------------------- | ---------------------------------- | ----- |
| **`value`** | <code>string \| null</code> | The value of the custom attribute. | 6.3.0 |


#### GetAttributeOptions

| Prop | Type | Description | Since |
| --------------- | ------------------- | -------------------------------------------- | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to set its attribute. | 6.3.0 |
| **`attribute`** | <code>string</code> | Name of the attribute to retrieve its value. | 6.3.0 |


#### GetAttributesResult

| Prop | Type | Description | Since |
| ----------- | ------------------------------------- | ------------------------------------------------------------ | ----- |
| **`value`** | <code>{ [k: string]: string; }</code> | A map of all custom attributes of a trace with their values. | 6.3.0 |


#### GetAttributesOptions

| Prop | Type | Description | Since |
| --------------- | ------------------- | ---------------------------------------- | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to get its attributes. | 6.3.0 |


#### PutMetricOptions

| Prop | Type | Description | Since |
| ---------------- | ------------------- | ---------------------------------------------------------------------------------------- | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to set its metric. | 6.3.0 |
| **`metricName`** | <code>string</code> | The metric name. | 6.3.0 |
| **`num`** | <code>number</code> | The value to set for the metric. The given value is floored down to the nearest integer. | 6.3.0 |


#### GetMetricResult

| Prop | Type | Description | Since |
| ----------- | --------------------------- | ---------------------------------------------------------- | ----- |
| **`value`** | <code>number \| null</code> | The value of the metric if exists. If not it will be null. | 6.3.0 |


#### GetMetricOptions

| Prop | Type | Description | Since |
| ---------------- | ------------------- | ------------------------------------ | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to get its metric. | 6.3.0 |
| **`metricName`** | <code>string</code> | The metric name. | 6.3.0 |


#### RecordOptions

| Prop | Type | Description | Since |
| --------------- | ----------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | ----- |
| **`traceName`** | <code>string</code> | Name of the trace to record. | 6.3.0 |
| **`startTime`** | <code>number</code> | Start time of the trace since epoch in milliseconds. | 6.3.0 |
| **`duration`** | <code>number</code> | The duration of the trace in milliseconds. | 6.3.0 |
| **`options`** | <code>{ metrics?: { [key: string]: number; }; attributes?: { [key: string]: string; }; }</code> | An optional object that hold optional maps of custom metrics and attributes. | 6.3.0 |


### Type Aliases


#### RemoveAttributeOptions

<code><a href="#getattributeoptions">GetAttributeOptions</a></code>

</docgen-api>

## Changelog
Expand Down
Loading

0 comments on commit 67c0f3a

Please sign in to comment.