@orpc/otel 0.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2023 oRPC
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,90 @@
1
+ <div align="center">
2
+ <image align="center" src="https://orpc.unnoq.com/logo.webp" width=280 alt="oRPC logo" />
3
+ </div>
4
+
5
+ <h1></h1>
6
+
7
+ <div align="center">
8
+ <a href="https://codecov.io/gh/unnoq/orpc">
9
+ <img alt="codecov" src="https://codecov.io/gh/unnoq/orpc/branch/main/graph/badge.svg">
10
+ </a>
11
+ <a href="https://www.npmjs.com/package/@orpc/otel">
12
+ <img alt="weekly downloads" src="https://img.shields.io/npm/dw/%40orpc%2Fotel?logo=npm" />
13
+ </a>
14
+ <a href="https://github.com/unnoq/orpc/blob/main/LICENSE">
15
+ <img alt="MIT License" src="https://img.shields.io/github/license/unnoq/orpc?logo=open-source-initiative" />
16
+ </a>
17
+ <a href="https://discord.gg/TXEbwRBvQn">
18
+ <img alt="Discord" src="https://img.shields.io/discord/1308966753044398161?color=7389D8&label&logo=discord&logoColor=ffffff" />
19
+ </a>
20
+ </div>
21
+
22
+ <h3 align="center">Typesafe APIs Made Simple 🪄</h3>
23
+
24
+ **oRPC is a powerful combination of RPC and OpenAPI**, makes it easy to build APIs that are end-to-end type-safe and adhere to OpenAPI standards
25
+
26
+ ---
27
+
28
+ ## Highlights
29
+
30
+ - **🔗 End-to-End Type Safety**: Ensure type-safe inputs, outputs, and errors from client to server.
31
+ - **📘 First-Class OpenAPI**: Built-in support that fully adheres to the OpenAPI standard.
32
+ - **📝 Contract-First Development**: Optionally define your API contract before implementation.
33
+ - **⚙️ Framework Integrations**: Seamlessly integrate with TanStack Query (React, Vue, Solid, Svelte, Angular), Pinia Colada, and more.
34
+ - **🚀 Server Actions**: Fully compatible with React Server Actions on Next.js, TanStack Start, and other platforms.
35
+ - **🔠 Standard Schema Support**: Works out of the box with Zod, Valibot, ArkType, and other schema validators.
36
+ - **🗃️ Native Types**: Supports native types like Date, File, Blob, BigInt, URL, and more.
37
+ - **⏱️ Lazy Router**: Enhance cold start times with our lazy routing feature.
38
+ - **📡 SSE & Streaming**: Enjoy full type-safe support for SSE and streaming.
39
+ - **🌍 Multi-Runtime Support**: Fast and lightweight on Cloudflare, Deno, Bun, Node.js, and beyond.
40
+ - **🔌 Extendability**: Easily extend functionality with plugins, middleware, and interceptors.
41
+ - **🛡️ Reliability**: Well-tested, TypeScript-based, production-ready, and MIT licensed.
42
+
43
+ ## Documentation
44
+
45
+ You can find the full documentation [here](https://orpc.unnoq.com).
46
+
47
+ ## Packages
48
+
49
+ - [@orpc/contract](https://www.npmjs.com/package/@orpc/contract): Build your API contract.
50
+ - [@orpc/server](https://www.npmjs.com/package/@orpc/server): Build your API or implement API contract.
51
+ - [@orpc/client](https://www.npmjs.com/package/@orpc/client): Consume your API on the client with type-safety.
52
+ - [@orpc/openapi](https://www.npmjs.com/package/@orpc/openapi): Generate OpenAPI specs and handle OpenAPI requests.
53
+ - [@orpc/nest](https://www.npmjs.com/package/@orpc/nest): Deeply integrate oRPC with [NestJS](https://nestjs.com/).
54
+ - [@orpc/react](https://www.npmjs.com/package/@orpc/react): Utilities for integrating oRPC with React and React Server Actions.
55
+ - [@orpc/tanstack-query](https://www.npmjs.com/package/@orpc/tanstack-query): [TanStack Query](https://tanstack.com/query/latest) integration.
56
+ - [@orpc/vue-colada](https://www.npmjs.com/package/@orpc/vue-colada): Integration with [Pinia Colada](https://pinia-colada.esm.dev/).
57
+ - [@orpc/hey-api](https://www.npmjs.com/package/@orpc/hey-api): [Hey API](https://heyapi.dev/) integration.
58
+ - [@orpc/zod](https://www.npmjs.com/package/@orpc/zod): More schemas that [Zod](https://zod.dev/) doesn't support yet.
59
+ - [@orpc/valibot](https://www.npmjs.com/package/@orpc/valibot): OpenAPI spec generation from [Valibot](https://valibot.dev/).
60
+ - [@orpc/arktype](https://www.npmjs.com/package/@orpc/arktype): OpenAPI spec generation from [ArkType](https://arktype.io/).
61
+
62
+ ## `@orpc/otel`
63
+
64
+ This package provides OpenTelemetry support for oRPC, allowing you to trace your API calls and monitor performance.
65
+
66
+ ### Installation
67
+
68
+ ```bash
69
+ npm install @orpc/otel @opentelemetry/api
70
+ ```
71
+
72
+ ### Usage
73
+
74
+ ```ts
75
+ import { initializeORPCOtel } from '@orpc/otel'
76
+
77
+ void initializeORPCOtel()
78
+ ```
79
+
80
+ ## Sponsors
81
+
82
+ <p align="center">
83
+ <a href="https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg">
84
+ <img src='https://cdn.jsdelivr.net/gh/unnoq/unnoq/sponsors.svg'/>
85
+ </a>
86
+ </p>
87
+
88
+ ## License
89
+
90
+ Distributed under the MIT License. See [LICENSE](https://github.com/unnoq/orpc/blob/main/LICENSE) for more information.
@@ -0,0 +1,12 @@
1
+ import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
2
+
3
+ interface ORPCInstrumentationConfig extends InstrumentationConfig {
4
+ }
5
+ declare class ORPCInstrumentation extends InstrumentationBase {
6
+ constructor(config?: ORPCInstrumentationConfig);
7
+ protected init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | void;
8
+ enable(): void;
9
+ }
10
+
11
+ export { ORPCInstrumentation };
12
+ export type { ORPCInstrumentationConfig };
@@ -0,0 +1,12 @@
1
+ import { InstrumentationConfig, InstrumentationBase, InstrumentationModuleDefinition } from '@opentelemetry/instrumentation';
2
+
3
+ interface ORPCInstrumentationConfig extends InstrumentationConfig {
4
+ }
5
+ declare class ORPCInstrumentation extends InstrumentationBase {
6
+ constructor(config?: ORPCInstrumentationConfig);
7
+ protected init(): InstrumentationModuleDefinition | InstrumentationModuleDefinition[] | void;
8
+ enable(): void;
9
+ }
10
+
11
+ export { ORPCInstrumentation };
12
+ export type { ORPCInstrumentationConfig };
package/dist/index.mjs ADDED
@@ -0,0 +1,23 @@
1
+ import { context, trace } from '@opentelemetry/api';
2
+ import { InstrumentationBase } from '@opentelemetry/instrumentation';
3
+ import { setGlobalOtelConfig } from '@orpc/shared';
4
+
5
+ const ORPC_OTEL_PACKAGE_NAME = "@orpc/otel";
6
+ const ORPC_OTEL_PACKAGE_VERSION = "0.0.0";
7
+
8
+ class ORPCInstrumentation extends InstrumentationBase {
9
+ constructor(config = {}) {
10
+ super(ORPC_OTEL_PACKAGE_NAME, ORPC_OTEL_PACKAGE_VERSION, config);
11
+ }
12
+ init() {
13
+ }
14
+ enable() {
15
+ setGlobalOtelConfig({
16
+ tracer: trace.getTracer(ORPC_OTEL_PACKAGE_NAME, ORPC_OTEL_PACKAGE_VERSION),
17
+ trace,
18
+ context
19
+ });
20
+ }
21
+ }
22
+
23
+ export { ORPCInstrumentation };
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@orpc/otel",
3
+ "type": "module",
4
+ "version": "0.0.0",
5
+ "license": "MIT",
6
+ "homepage": "https://orpc.unnoq.com",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/unnoq/orpc.git",
10
+ "directory": "packages/otel"
11
+ },
12
+ "keywords": [
13
+ "unnoq",
14
+ "orpc"
15
+ ],
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.mts",
19
+ "import": "./dist/index.mjs",
20
+ "default": "./dist/index.mjs"
21
+ }
22
+ },
23
+ "files": [
24
+ "dist"
25
+ ],
26
+ "peerDependencies": {
27
+ "@opentelemetry/api": ">=1.9.0",
28
+ "@opentelemetry/instrumentation": ">=0.203.0"
29
+ },
30
+ "dependencies": {
31
+ "@orpc/shared": "1.7.9"
32
+ },
33
+ "devDependencies": {
34
+ "@opentelemetry/api": "^1.9.0",
35
+ "@opentelemetry/instrumentation": "^0.203.0"
36
+ },
37
+ "scripts": {
38
+ "build": "unbuild",
39
+ "build:watch": "pnpm run build --watch",
40
+ "type:check": "tsc -b"
41
+ }
42
+ }