> ## Documentation Index
> Fetch the complete documentation index at: https://stars-components.js.org/llms.txt
> Use this file to discover all available pages before exploring further.

# @wolfstar/shared-influx-pieces

> Collect interaction metrics through reusable Influx pieces.

<CodeGroup>
  ```bash npm theme={"system"}
  npm install @wolfstar/shared-influx-pieces
  ```

  ```bash pnpm theme={"system"}
  pnpm add @wolfstar/shared-influx-pieces
  ```

  ```bash yarn theme={"system"}
  yarn add @wolfstar/shared-influx-pieces
  ```

  ```bash bun theme={"system"}
  bun add @wolfstar/shared-influx-pieces
  ```
</CodeGroup>

<CardGroup cols={2}>
  <Card title="npm" icon="npm" horizontal href="https://npmx.dev/package/@wolfstar/shared-influx-pieces" />

  <Card title="Source" icon="github" horizontal href="https://github.com/wolfstar-project/stars-components/tree/main/packages/shared-influx-pieces" />
</CardGroup>

## Description

The shared influx pieces used in Star Network's HTTP-only bots.

## Usage

You can either register after setting the environment parameters:

```typescript theme={"system"}
process.env.INFLUX_URL = 'https://influxdb.wolfstar.rocks';
process.env.INFLUX_TOKEN = 'my-secret-token';
process.env.INFLUX_ORG = 'Wolfstar-Project';
process.env.INFLUX_BUCKET = 'analytics';

import '@wolfstar/shared-influx-pieces/register';
```

Or register manually:

```typescript theme={"system"}
import { container } from '@wolfstar/http-framework';
import { InfluxClient } from '@wolfstar/shared-influx-pieces';

container.influx = new InfluxClient({
	url: 'https://influxdb.wolfstar.rocks',
	token: 'my-secret-token',
	org: 'Wolfstar-Project',
	writeBucket: 'analytics'
});
```

> \[!IMPORTANT]
> In order to manual registering to work as intended, you must register the instance in `container.influx` as shown above.
