@octaviaflow/telemetry-attributes
v1.1.1
Published
OctaviaFlow Telemetry attribute definitions for JS code
Downloads
95
Maintainers
Readme
OctaviaFlow Telemetry Attributes
Attribute definitions and constants for OctaviaFlow Telemetry
Overview
This package provides standardized attribute definitions and constants used by the OctaviaFlow Telemetry system. It defines the structure and naming conventions for telemetry data across different collection scopes.
Installation
npm install @octaviaflow/telemetry-attributesUsage
import {
JsScopeAttributes,
JsxScopeAttributes,
NpmScopeAttributes,
WcScopeAttributes,
CustomResourceAttributes,
LogsAttributes,
ALL_SCOPE_NAMES
} from '@octaviaflow/telemetry-attributes';
// Use scope names
console.log(JsScopeAttributes.SCOPE_NAME); // 'js'
console.log(JsxScopeAttributes.SCOPE_NAME); // 'jsx'
// Use metric names
console.log(JsScopeAttributes.JS_FUNCTION_METRIC); // 'js.function'
console.log(JsxScopeAttributes.JSX_ELEMENT_METRIC); // 'jsx.element'
// Use attribute names
console.log(JsScopeAttributes.FUNCTION_NAME); // 'js.function.name'
console.log(JsxScopeAttributes.ELEMENT_NAME); // 'jsx.element.name'Available Scopes
JavaScript Scope (JsScopeAttributes)
Attributes for JavaScript token and function analysis:
JsScopeAttributes.SCOPE_NAME // 'js'
JsScopeAttributes.JS_TOKEN_METRIC // 'js.token'
JsScopeAttributes.JS_FUNCTION_METRIC // 'js.function'
JsScopeAttributes.TOKEN_NAME // 'js.token.name'
JsScopeAttributes.TOKEN_ACCESS_PATH // 'js.token.accessPath'
JsScopeAttributes.TOKEN_MODULE_SPECIFIER // 'js.token.module.specifier'
JsScopeAttributes.FUNCTION_NAME // 'js.function.name'
JsScopeAttributes.FUNCTION_ACCESS_PATH // 'js.function.accessPath'
JsScopeAttributes.FUNCTION_ARGUMENT_VALUES // 'js.function.arguments.values'
JsScopeAttributes.FUNCTION_MODULE_SPECIFIER // 'js.function.module.specifier'JSX Scope (JsxScopeAttributes)
Attributes for React component analysis:
JsxScopeAttributes.SCOPE_NAME // 'jsx'
JsxScopeAttributes.JSX_ELEMENT_METRIC // 'jsx.element'
JsxScopeAttributes.ELEMENT_NAME // 'jsx.element.name'
JsxScopeAttributes.ELEMENT_ATTRIBUTE_NAMES // 'jsx.element.attributeNames'
JsxScopeAttributes.ELEMENT_ATTRIBUTE_VALUES // 'jsx.element.attributeValues'
JsxScopeAttributes.ELEMENT_MODULE_SPECIFIER // 'jsx.element.module.specifier'NPM Scope (NpmScopeAttributes)
Attributes for NPM dependency analysis:
NpmScopeAttributes.SCOPE_NAME // 'npm'
NpmScopeAttributes.NPM_DEPENDENCY_METRIC // 'npm.dependency'
NpmScopeAttributes.DEPENDENCY_NAME // 'npm.dependency.name'
NpmScopeAttributes.DEPENDENCY_VERSION // 'npm.dependency.version'
NpmScopeAttributes.DEPENDENCY_TYPE // 'npm.dependency.type'
NpmScopeAttributes.PROJECT_NAME // 'npm.project.name'
NpmScopeAttributes.PROJECT_VERSION // 'npm.project.version'Web Components Scope (WcScopeAttributes)
Attributes for Web Component analysis:
WcScopeAttributes.SCOPE_NAME // 'wc'
WcScopeAttributes.WC_ELEMENT_METRIC // 'wc.element'
WcScopeAttributes.ELEMENT_NAME // 'wc.element.name'
WcScopeAttributes.ELEMENT_ATTRIBUTE_NAMES // 'wc.element.attributeNames'
WcScopeAttributes.ELEMENT_ATTRIBUTE_VALUES // 'wc.element.attributeValues'
WcScopeAttributes.ELEMENT_MODULE_SPECIFIER // 'wc.element.module.specifier'Custom Resource Attributes (CustomResourceAttributes)
octaviaflow-specific resource attributes:
CustomResourceAttributes.octaviaflow_PROJECT_ID // 'octaviaflow.project.id'
CustomResourceAttributes.octaviaflow_PROJECT_NAME // 'octaviaflow.project.name'
CustomResourceAttributes.octaviaflow_PROJECT_VERSION // 'octaviaflow.project.version'
CustomResourceAttributes.octaviaflow_COLLECTION_TIMESTAMP // 'octaviaflow.collection.timestamp'
CustomResourceAttributes.octaviaflow_STORAGE_TYPE // 'octaviaflow.storage.type'
CustomResourceAttributes.octaviaflow_STORAGE_LOCATION // 'octaviaflow.storage.location'Logs Attributes (LogsAttributes)
Attributes for logging and error tracking:
LogsAttributes.LOG_LEVEL // 'log.level'
LogsAttributes.LOG_MESSAGE // 'log.message'
LogsAttributes.LOG_TIMESTAMP // 'log.timestamp'
LogsAttributes.LOG_SOURCE // 'log.source'
LogsAttributes.LOG_FILE_PATH // 'log.file.path'
LogsAttributes.LOG_LINE_NUMBER // 'log.line.number'
LogsAttributes.LOG_FUNCTION_NAME // 'log.function.name'
LogsAttributes.LOG_ERROR_TYPE // 'log.error.type'
LogsAttributes.LOG_ERROR_MESSAGE // 'log.error.message'
LogsAttributes.LOG_ERROR_STACK // 'log.error.stack'Utility Constants
import { ALL_SCOPE_NAMES } from '@octaviaflow/telemetry-attributes';
console.log(ALL_SCOPE_NAMES); // ['js', 'jsx', 'npm', 'wc']Integration Example
import { JsScopeAttributes } from '@octaviaflow/telemetry-attributes';
// Create telemetry data with standardized attributes
const telemetryData = {
scope: JsScopeAttributes.SCOPE_NAME,
metric: JsScopeAttributes.JS_FUNCTION_METRIC,
attributes: {
[JsScopeAttributes.FUNCTION_NAME]: 'useAnalytics',
[JsScopeAttributes.FUNCTION_MODULE_SPECIFIER]: '@octaviaflow/analytics',
[JsScopeAttributes.FUNCTION_ARGUMENT_VALUES]: ['track', 'user_action']
}
};Related Packages
@octaviaflow/telemetry-collector- Main telemetry collection tool@octaviaflow/telemetry-config-schema- Configuration schema and validation
License
MIT © octaviaflow
