npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@octaviaflow/telemetry

v1.1.1

Published

JavaScript telemetry collection tooling for OctaviaFlow projects

Readme

Octaviaflow Telemetry Collector

JavaScript telemetry collection tooling for octaviaflow projects

License: MIT NPM version

Overview

Octaviaflow Telemetry Collector is a powerful analytics tool that captures anonymized usage data from JavaScript/TypeScript projects. It supports multiple data collection scopes including NPM dependencies, JSX components, JavaScript functions, and Web Components.

Key Features

  • File-based Storage: Store telemetry data in JSON files ready for MongoDB Atlas import
  • Multiple Collection Scopes: NPM, JSX, JavaScript, and Web Components
  • Privacy-First: Anonymized data collection with configurable allowlists
  • MongoDB Ready: Generated files are formatted for direct MongoDB import
  • CLI Tool: Easy-to-use command-line interface

Installation

npm install @octaviaflow/telemetry-collector

Quick Start

1. Create Configuration File

Create a telemetry.yml file in your project root:

# yaml-language-server: $schema=https://unpkg.com/@octaviaflow/telemetry-config-schema@1/dist/config.schema.json
version: 1
projectId: 'my-awesome-project'
name: 'my-awesome-project'
storage:
  type: 'file'
  file:
    directory: './telemetry-logs'
    fileNamePattern: 'octaviaflow-telemetry-{timestamp}.json'
    maxFileSizeMB: 10
collect:
  npm:
    dependencies:
  jsx:
    elements:
      allowedAttributeNames: ['size', 'variant']
      allowedAttributeStringValues: ['small', 'medium', 'large']

2. Run Collection

# Basic usage
npx octaviaflow-telemetry --config ./telemetry.yml

# With verbose output
npx octaviaflow-telemetry --config ./telemetry.yml --verbose

# Dry run (no data stored)
npx octaviaflow-telemetry --config ./telemetry.yml --dry-run

3. Import to MongoDB Atlas

After collection, import the generated JSON files to MongoDB Atlas:

mongoimport --uri "mongodb+srv://user:[email protected]/database" \
  --collection telemetry \
  --file ./telemetry-logs/octaviaflow-telemetry-2025-01-01T10-00-00-000Z.json

Configuration

Storage Options

File Storage (Current)

storage:
  type: 'file'
  file:
    directory: './telemetry-logs'           # Directory to store files
    fileNamePattern: 'octaviaflow-telemetry-{timestamp}.json'  # File naming pattern
    maxFileSizeMB: 10                       # Max file size before rotation
    compress: false                         # Enable compression (future)

MongoDB Storage (Future)

storage:
  type: 'mongodb'
  mongodb:
    connectionString: 'mongodb+srv://user:[email protected]'
    database: 'telemetry'
    collection: 'metrics'

Collection Scopes

NPM Dependencies

Captures package dependency information:

collect:
  npm:
    dependencies:  # Captures all dependencies and versions

JSX Components

Captures React component usage:

collect:
  jsx:
    elements:
      allowedAttributeNames:
        - 'size'
        - 'variant'
        - 'color'
      allowedAttributeStringValues:
        - 'small'
        - 'medium'
        - 'large'

JavaScript Functions

Captures function calls and arguments:

collect:
  js:
    tokens:  # Captures imported tokens
    functions:
      allowedArgumentStringValues:
        - 'debug'
        - 'info'
        - 'error'

Web Components

Captures Web Component usage:

collect:
  wc:
    elements:
      allowedAttributeNames:
        - 'type'
        - 'disabled'
      allowedAttributeStringValues:
        - 'button'
        - 'submit'

CLI Options

octaviaflow-telemetry [options]

Options:
  -c, --config <path>  Path to telemetry configuration file (default: "./telemetry.yml")
  -v, --verbose        Enable verbose logging
  --dry-run           Perform a dry run without storing data
  -h, --help          Display help for command
  --version           Display version number

Data Format

Generated JSON files contain telemetry data in MongoDB-ready format:

{
  "_id": "507f1f77bcf86cd799439011",
  "timestamp": "2025-01-01T10:00:00.000Z",
  "projectId": "my-awesome-project",
  "scope": "jsx",
  "metric": "jsx.element",
  "data": {
    "elements": [
      {
        "name": "Button",
        "attributes": { "size": "large", "variant": "primary" },
        "moduleSpecifier": "@octaviaflow/ui"
      }
    ]
  },
  "metadata": {
    "collectionTimestamp": "2025-01-01T10:00:00.000Z",
    "storageType": "file",
    "collectionMethod": "jsx-analysis"
  }
}

Integration with Package

Add telemetry collection to your package's postinstall script:

{
  "scripts": {
    "postinstall": "octaviaflow-telemetry --config ./telemetry.yml"
  }
}

Privacy and Data Collection

  • Anonymized by Default: All sensitive data is anonymized unless specifically allowlisted
  • Configurable Collection: Only collect data you explicitly configure
  • Local Storage: Data is stored locally in files, giving you full control
  • No External Calls: No data is sent to external servers automatically

MongoDB Atlas Import

Prepare Data for Import

The collector can prepare all collected data for MongoDB import:

import { FileStorage } from '@octaviaflow/telemetry-collector';

const storage = new FileStorage({ directory: './telemetry-logs' });
const importFile = await storage.prepareForMongoImport('./mongodb-ready.json');
console.log('Ready for import:', importFile);

Import Commands

# Import single file
mongoimport --uri "your-connection-string" \
  --collection telemetry \
  --file ./telemetry-logs/octaviaflow-telemetry-2025-01-01T10-00-00-000Z.json

# Import all files
for file in ./telemetry-logs/*.json; do
  mongoimport --uri "your-connection-string" \
    --collection telemetry \
    --file "$file"
done

Related Packages

License

MIT © octaviaflow