Compare commits

...

23 Commits

Author SHA1 Message Date
4eb680d3fb 1.0.14 2024-06-14 22:03:07 +02:00
82b846e445 fix(core): update 2024-06-14 22:03:07 +02:00
8fcd212516 1.0.13 2024-06-14 17:15:44 +02:00
dd5c37617d fix(core): update 2024-06-14 17:15:43 +02:00
8590b51fd3 1.0.12 2024-06-14 17:14:55 +02:00
e6a5edeb25 fix(core): update 2024-06-14 17:14:55 +02:00
ea77049468 update description 2024-05-29 14:14:10 +02:00
093055b413 update tsconfig 2024-04-14 17:49:32 +02:00
201654197d update npmextra.json: githost 2024-04-01 21:36:01 +02:00
9356284b70 update npmextra.json: githost 2024-04-01 19:58:42 +02:00
432b4d200a update npmextra.json: githost 2024-03-30 21:47:41 +01:00
014a95a0db switch to new org scheme 2023-07-11 00:59:31 +02:00
d1b11a6019 switch to new org scheme 2023-07-10 10:02:35 +02:00
792729258b 1.0.11 2022-08-05 13:38:12 +02:00
3cd188be28 fix(core): update 2022-08-05 13:38:12 +02:00
97dc286fb5 1.0.10 2022-08-02 19:38:49 +02:00
ade995324a fix(core): update 2022-08-02 19:38:48 +02:00
7da10af365 1.0.9 2022-07-28 17:56:27 +02:00
18a212451e fix(core): update 2022-07-28 17:56:26 +02:00
56a257f44a 1.0.8 2022-07-28 17:00:46 +02:00
fac829ba9e fix(core): update 2022-07-28 17:00:46 +02:00
e4138b7dcf 1.0.7 2022-07-27 23:19:35 +02:00
88b3e39383 fix(core): update 2022-07-27 23:19:35 +02:00
14 changed files with 9180 additions and 3004 deletions

View File

@ -0,0 +1,66 @@
name: Default (not tags)
on:
push:
tags-ignore:
- '**'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Install pnpm and npmci
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
- name: Run npm prepare
run: npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build

View File

@ -0,0 +1,124 @@
name: Default (tags)
on:
push:
tags:
- '*'
env:
IMAGE: registry.gitlab.com/hosttoday/ht-docker-node:npmci
NPMCI_COMPUTED_REPOURL: https://${{gitea.repository_owner}}:${{secrets.GITEA_TOKEN}}@gitea.lossless.digital/${{gitea.repository}}.git
NPMCI_TOKEN_NPM: ${{secrets.NPMCI_TOKEN_NPM}}
NPMCI_TOKEN_NPM2: ${{secrets.NPMCI_TOKEN_NPM2}}
NPMCI_GIT_GITHUBTOKEN: ${{secrets.NPMCI_GIT_GITHUBTOKEN}}
NPMCI_URL_CLOUDLY: ${{secrets.NPMCI_URL_CLOUDLY}}
jobs:
security:
runs-on: ubuntu-latest
continue-on-error: true
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Audit production dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --prod
continue-on-error: true
- name: Audit development dependencies
run: |
npmci command npm config set registry https://registry.npmjs.org
npmci command pnpm audit --audit-level=high --dev
continue-on-error: true
test:
if: ${{ always() }}
needs: security
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Test stable
run: |
npmci node install stable
npmci npm install
npmci npm test
- name: Test build
run: |
npmci node install stable
npmci npm install
npmci npm build
release:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Release
run: |
npmci node install stable
npmci npm publish
metadata:
needs: test
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
container:
image: ${{ env.IMAGE }}
continue-on-error: true
steps:
- uses: actions/checkout@v3
- name: Prepare
run: |
pnpm install -g pnpm
pnpm install -g @shipzone/npmci
npmci npm prepare
- name: Code quality
run: |
npmci command npm install -g typescript
npmci npm install
- name: Trigger
run: npmci trigger
- name: Build docs and upload artifacts
run: |
npmci node install stable
npmci npm install
pnpm install -g @git.zone/tsdoc
npmci command tsdoc
continue-on-error: true

View File

@ -1,4 +1,4 @@
Copyright (c) 2022 Lossless GmbH (hello@lossless.com)
Copyright (c) 2014 Task Venture Capital GmbH (hello@task.vc)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -2,17 +2,32 @@
"gitzone": {
"projectType": "npm",
"module": {
"githost": "gitlab.com",
"gitscope": "pushrocks",
"githost": "code.foss.global",
"gitscope": "push.rocks",
"gitrepo": "smartlog-destination-clickhouse",
"description": "a smartlog destination pushing logs to clickhouse",
"npmPackagename": "@pushrocks/smartlog-destination-clickhouse",
"description": "A library to integrate Smartlog logging with ClickHouse database for efficient log storage and querying.",
"npmPackagename": "@push.rocks/smartlog-destination-clickhouse",
"license": "MIT",
"projectDomain": "push.rocks"
"projectDomain": "push.rocks",
"keywords": [
"logging",
"clickhouse",
"smartlog",
"log management",
"database integration",
"typescript",
"real-time logging",
"structured logging",
"log storage",
"log querying"
]
}
},
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
},
"tsdoc": {
"legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n"
}
}

4713
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
{
"name": "@pushrocks/smartlog-destination-clickhouse",
"version": "1.0.6",
"name": "@push.rocks/smartlog-destination-clickhouse",
"version": "1.0.14",
"private": false,
"description": "a smartlog destination pushing logs to clickhouse",
"description": "A library to integrate Smartlog logging with ClickHouse database for efficient log storage and querying.",
"main": "dist_ts/index.js",
"typings": "dist_ts/index.d.ts",
"type": "module",
@ -14,16 +14,16 @@
"buildDocs": "(tsdoc)"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.1.25",
"@gitzone/tsbundle": "^2.0.5",
"@gitzone/tsdoc": "^1.1.10",
"@gitzone/tstest": "^1.0.44",
"@pushrocks/tapbundle": "^5.0.3",
"@types/node": "^18.6.1"
"@git.zone/tsbuild": "^2.1.80",
"@git.zone/tsbundle": "^2.0.8",
"@git.zone/tsrun": "^1.2.46",
"@git.zone/tstest": "^1.0.90",
"@push.rocks/tapbundle": "^5.0.23",
"@types/node": "^20.14.2"
},
"dependencies": {
"@pushrocks/smartclickhouse": "^2.0.5",
"@pushrocks/smartlog-interfaces": "^2.0.23"
"@push.rocks/smartclickhouse": "^2.0.17",
"@push.rocks/smartlog-interfaces": "^3.0.2"
},
"browserslist": [
"last 1 chrome versions"
@ -39,5 +39,22 @@
"cli.js",
"npmextra.json",
"readme.md"
]
],
"keywords": [
"logging",
"clickhouse",
"smartlog",
"log management",
"database integration",
"typescript",
"real-time logging",
"structured logging",
"log storage",
"log querying"
],
"homepage": "https://code.foss.global/push.rocks/smartlog-destination-clickhouse",
"repository": {
"type": "git",
"url": "https://code.foss.global/push.rocks/smartlog-destination-clickhouse.git"
}
}

7061
pnpm-lock.yaml generated Normal file

File diff suppressed because it is too large Load Diff

1
readme.hints.md Normal file
View File

@ -0,0 +1 @@

108
readme.md
View File

@ -1,39 +1,93 @@
# @pushrocks/smartlog-destination-clickhouse
# @push.rocks/smartlog-destination-clickhouse
a smartlog destination pushing logs to clickhouse
## Availabililty and Links
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartlog-destination-clickhouse)
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartlog-destination-clickhouse)
* [github.com (source mirror)](https://github.com/pushrocks/smartlog-destination-clickhouse)
* [docs (typedoc)](https://pushrocks.gitlab.io/smartlog-destination-clickhouse/)
## Install
To start using `@push.rocks/smartlog-destination-clickhouse`, you need to install it using npm (Node Package Manager). Run the following command in your terminal:
## Status for master
```bash
npm install @push.rocks/smartlog-destination-clickhouse --save
```
Status Category | Status Badge
-- | --
GitLab Pipelines | [![pipeline status](https://gitlab.com/pushrocks/smartlog-destination-clickhouse/badges/master/pipeline.svg)](https://lossless.cloud)
GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/pushrocks/smartlog-destination-clickhouse/badges/master/coverage.svg)](https://lossless.cloud)
npm | [![npm downloads per month](https://badgen.net/npm/dy/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud)
Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud)
TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud)
node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/)
Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud)
PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud)
PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud)
BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@pushrocks/smartlog-destination-clickhouse)](https://lossless.cloud)
Platform support | [![Supports Windows 10](https://badgen.net/badge/supports%20Windows%2010/yes/green?icon=windows)](https://lossless.cloud) [![Supports Mac OS X](https://badgen.net/badge/supports%20Mac%20OS%20X/yes/green?icon=apple)](https://lossless.cloud)
This command will download the package and add it as a dependency to your project's `package.json` file.
## Usage
Use TypeScript for best in class intellisense
`@push.rocks/smartlog-destination-clickhouse` enables your applications to push logs directly to a ClickHouse database. This can be extremely useful for applications needing to log large amounts of data efficiently and perform complex analytics on logged data.
## Contribution
To get started, you'll first need to import the necessary modules and initialize the smartlog destination for ClickHouse. Here's a step-by-step guide using TypeScript with ESM syntax:
We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :)
### Step 1: Import Modules
For further information read the linked docs at the top of this readme.
First, you need to import the `SmartlogDestinationClickhouse` class from the package:
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy)
```typescript
import { SmartlogDestinationClickhouse } from '@push.rocks/smartlog-destination-clickhouse';
```
[![repo-footer](https://lossless.gitlab.io/publicrelations/repofooter.svg)](https://maintainedby.lossless.com)
### Step 2: Initialize Smartlog Destination
Before you can push logs to ClickHouse, you need to create an instance of `SmartlogDestinationClickhouse` and start it. This involves providing configuration details for your ClickHouse instance.
```typescript
// Define ClickHouse configuration
const clickhouseConfig = {
host: 'your_clickhouse_host',
port: 8123, // default ClickHouse HTTP interface port
db: 'your_database_name',
user: 'your_clickhouse_user',
password: 'your_clickhouse_password',
};
// Create and start the SmartlogDestinationClickhouse instance
const smartlogDestination = await SmartlogDestinationClickhouse.createAndStart(clickhouseConfig);
```
This setup initializes the connection to your ClickHouse database and prepares it for logging.
### Step 3: Log Handling
Now that the setup is complete, you can start handling logs. The `handleLog` method provided by `SmartlogDestinationClickhouse` allows you to push log packages to your ClickHouse database.
```typescript
import { ILogPackage } from '@push.rocks/smartlog-interfaces';
// Sample log package
const sampleLogPackage: ILogPackage<unknown> = {
logLevel: 'info',
message: 'This is a test log message',
additionalData: {
// Any additional data you wish to log
key: 'value'
}
};
// Handle log
await smartlogDestination.handleLog(sampleLogPackage);
```
This will push the log to your ClickHouse database, making it available for querying and analysis.
### Conclusion
By following these steps, you can efficiently push logs to a ClickHouse database using `@push.rocks/smartlog-destination-clickhouse`. This setup provides a powerful and scalable logging solution for modern applications, enabling complex analytics on logged data.
Remember to always manage your database connections responsibly and ensure you have appropriate logging levels and data retention policies in place to avoid overwhelming your database with excessive logging data.
## License and Legal Information
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
### Trademarks
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
### Company Information
Task Venture Capital GmbH
Registered at District court Bremen HRB 35230 HB, Germany
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.

View File

@ -1,4 +1,4 @@
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as slclick from '../ts/index.js';
tap.test('first test', async () => {

View File

@ -2,7 +2,7 @@
* autocreated commitinfo by @pushrocks/commitinfo
*/
export const commitinfo = {
name: '@pushrocks/smartlog-destination-clickhouse',
version: '1.0.6',
description: 'a smartlog destination pushing logs to clickhouse'
name: '@push.rocks/smartlog-destination-clickhouse',
version: '1.0.14',
description: 'A library to integrate Smartlog logging with ClickHouse database for efficient log storage and querying.'
}

View File

@ -2,12 +2,14 @@ import * as plugins from './slclick.plugins.js';
export class SmartlogDestinationClickhouse implements plugins.smartlogInterfaces.ILogDestination {
// STATIC
public static async createAndStart(optionsArg: plugins.smartclickhouse.IClickhouseConstructorOptions) {
public static async createAndStart(
optionsArg: plugins.smartclickhouse.IClickhouseConstructorOptions
) {
const destinationClickhouse = new SmartlogDestinationClickhouse(optionsArg);
await destinationClickhouse.start();
return destinationClickhouse;
}
// INSTANCE
private smartclickhouseDb: plugins.smartclickhouse.SmartClickHouseDb;
private logTable: plugins.smartclickhouse.TimeDataTable;
@ -19,8 +21,10 @@ export class SmartlogDestinationClickhouse implements plugins.smartlogInterfaces
await this.smartclickhouseDb.start();
this.logTable = await this.smartclickhouseDb.getTable('logs');
}
public async handleLog(logPackage: plugins.smartlogInterfaces.ILogPackage<unknown>): Promise<void> {
public async handleLog(
logPackage: plugins.smartlogInterfaces.ILogPackage<unknown>
): Promise<void> {
await this.logTable.addData(logPackage);
};
}
}

View File

@ -1,8 +1,5 @@
// pushrocks scope
import * as smartlogInterfaces from '@pushrocks/smartlog-interfaces';
import * as smartclickhouse from '@pushrocks/smartclickhouse';
import * as smartlogInterfaces from '@push.rocks/smartlog-interfaces';
import * as smartclickhouse from '@push.rocks/smartclickhouse';
export {
smartlogInterfaces,
smartclickhouse
}
export { smartlogInterfaces, smartclickhouse };

View File

@ -3,8 +3,12 @@
"experimentalDecorators": true,
"useDefineForClassFields": false,
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "nodenext",
"esModuleInterop": true
}
"module": "NodeNext",
"moduleResolution": "NodeNext",
"esModuleInterop": true,
"verbatimModuleSyntax": true
},
"exclude": [
"dist_*/**/*.d.ts"
]
}