{"id":18811727,"url":"https://github.com/logicmonitor/lm-data-sdk-js","last_synced_at":"2026-01-11T14:30:19.581Z","repository":{"id":144709277,"uuid":"514200674","full_name":"logicmonitor/lm-data-sdk-js","owner":"logicmonitor","description":"LogicMonitor's data SDK for Javascript","archived":false,"fork":false,"pushed_at":"2023-09-25T13:05:11.000Z","size":750,"stargazers_count":1,"open_issues_count":5,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2024-12-30T00:13:27.047Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/logicmonitor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-07-15T08:53:28.000Z","updated_at":"2023-02-04T22:27:58.000Z","dependencies_parsed_at":null,"dependency_job_id":"22ebcec0-ee66-4452-a771-ec1455e670d9","html_url":"https://github.com/logicmonitor/lm-data-sdk-js","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-data-sdk-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-data-sdk-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-data-sdk-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/logicmonitor%2Flm-data-sdk-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/logicmonitor","download_url":"https://codeload.github.com/logicmonitor/lm-data-sdk-js/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239748248,"owners_count":19690232,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-07T23:27:26.882Z","updated_at":"2026-01-11T14:30:19.549Z","avatar_url":"https://github.com/logicmonitor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LogicMonitor JS Data SDK\n\nLogicMonitor JS Data SDK is suitable for ingesting the metrics and logs into the LogicMonitor Platform.\n\n## Overview\nLogicMonitor's Push Metrics feature allows you to send metrics directly to the LogicMonitor platform via a dedicated API, removing the need to route the data through a LogicMonitor Collector. Once ingested, these metrics are presented alongside all other metrics gathered via LogicMonitor, providing a single pane of glass for metric monitoring and alerting.\n\nSimilarly, If a log integration isn’t available or you have custom logs that you want to analyze, you can send the logs directly to your LogicMonitor account via the logs ingestion API.\n\n## Quick Start Notes:\n\n### Set Configurations\nWhile using LMv1 authentication set LM_ACCESS_ID and LM_ACCESS_KEY properties.\nIn case of BearerToken authentication set LM_BEARER_TOKEN property. \nCompany's name or Account name must be passed to LM_ACCOUNT property. \nAll properties can be set using environment variable.\n\n| Environment variable |\tDescription |\n| -------------------- |:--------------:|\n|   LM_ACCOUNT         |\tAccount name (Company Name) is your organization name |\n|   LM_ACCESS_ID       |\tAccess id while using LMv1 authentication.|\n|   LM_ACCESS_KEY      |\tAccess key while using LMv1 authentication.|\n|   LM_BEARER_TOKEN    |\tBearerToken while using Bearer authentication.|\n\n### Batching\n\nBy default, batching is disabled.\nIf enabled, the default batch time is 10s.\n### Logs\n\n    import {Log} from  '@logicmonitor-official/lm-data-sdk-js';\n    let log =  new  Log(true, 10); // Instantiate Logger with barching enabled and batching interval 10s\n    log.SendLogs(\n\t    'Log Message',\n\t    {\n\t        'system.displayname' : 'example-currency-service',\n\t    }\n\t)\n\n### Metrics\n\n    import {Metrics} from '@logicmonitor-official/lm-data-sdk-js';\n    //instantiate Metrics with batching enabled and bathing time set to 10s\n    let metric = new Metrics(true, 10);\n\n    // Build the Resource\n    let resource = new ResourceBuilder()\n                .setResourceName('LmExporterSDKTest_71799')\n                .setResourceIds({\n                    'system.displayname': 'LmExporterSDKTest_71799'\n                })\n                .build();\n    // Build DataSource\n    let dS1 = new DataSourceBuilder()\n                        .setDataSource('JsSDK')\n                        .setDataSourceDisplayName('JsSDK')\n                        .setDataSourceGroup('Sdk')\n                        .build();\n    \n    // Build Second DataSource\n    let dS2 = new DataSourceBuilder()\n        .setDataSource('MetricJsSDK')\n        .setDataSourceDisplayName('MetricJsSDK')\n        .setDataSourceGroup('Sdk')\n        .build();\n\n    // Build Instance\n    let i1 = new InstanceBuilder()\n                .setInstanceName('DataSDK')\n                .setInstanceDisplayName('DataSDK')\n                .setInstanceProperties(\n                    {\n                        'test': 'dataSDK'\n                    }\n                )\n                .build();\n    \n    //Build second Instance\n    let i2 = new InstanceBuilder()\n    .setInstanceName('MetricDataSDK')\n    .setInstanceDisplayName('MetricDataSDK')\n    .setInstanceProperties(\n    {\n        'test': 'dataSDK'\n    }\n    )\n    .build();\n            \n    // Build DataPoint\n    let dP1 = new DataPointBuilder()\n                    .setDataPointName('cpu')\n                    .setDataPointDescription('cpu')\n                    .setDataPointAggregationType('SUM')\n                    .setDataPointType('COUNTER')\n                    .build();\n\n    dP1.setValue(\n        Math.floor(Date.now()/1000).toString(),\n        '79'\n    )\n\n    //Build second DataPoint\n    let dP2 = new DataPointBuilder()\n                    .setDataPointName('mem')\n                    .setDataPointDescription('mem')\n                    .setDataPointAggregationType('SUM')\n                    .setDataPointType('COUNTER')\n                    .build();\n\n    dP2.setValue(\n        Math.floor(Date.now()/1000).toString(),\n        '100'\n    )\n\n    // Send metrics in various combinations.\n    metric.SendMetrics(resource,dS1,i1,dP1)\n    metric.SendMetrics(resource,dS1,i1,dP2)\n    metric.SendMetrics(resource,dS1,i2,dP1)\n    metric.SendMetrics(resource,dS1,i2,dP2)\n\n    metric.SendMetrics(resource,dS2,i1,dP1)\n    metric.SendMetrics(resource,dS2,i1,dP2)\n    metric.SendMetrics(resource,dS2,i2,dP1)\n    metric.SendMetrics(resource,dS2,i2,dP2)\n\nCopyright, 2022, LogicMonitor, Inc.\n\nThis Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-data-sdk-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flogicmonitor%2Flm-data-sdk-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flogicmonitor%2Flm-data-sdk-js/lists"}