@logbrew/next 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -93,7 +93,7 @@ export default withLogBrewNextReleaseArtifacts(
93
93
  service: "checkout-next-web",
94
94
  projectId: "550e8400-e29b-41d4-a716-446655440000",
95
95
  upload: {
96
- endpoint: "https://api.logbrew.com/api/release-artifacts",
96
+ endpoint: "https://api.logbrew.co/api/release-artifacts",
97
97
  allowHostedUpload: true,
98
98
  maxRetries: 2
99
99
  }
@@ -212,7 +212,7 @@ export const GET = withLogBrewRouteHandler(handler, {
212
212
  });
213
213
  ```
214
214
 
215
- The metric includes primitive, low-cardinality metadata: `framework`, `method`, `routeTemplate`, `statusCode`, and `statusCodeClass`. Next.js Route Handlers expose standard `Request` and `Response` objects, so pass a stable `routeTemplate` when a route contains dynamic segments. Query strings and hashes are omitted. Avoid user IDs, request payloads, headers, or free-form text in custom metric metadata. Use `metricName`, `metricIdFactory`, or `requestMetricEvent` when your app needs a different naming or metadata policy. Set `captureRequests: false` with `captureRequestMetrics: true` when you only want the duration metric and not the request log/span.
215
+ The metric carries the stable description `Duration of one completed server request.` plus primitive, low-cardinality metadata: `framework`, `method`, `routeTemplate`, `statusCode`, and `statusCodeClass`. Next.js Route Handlers expose standard `Request` and `Response` objects, so pass a stable `routeTemplate` when a route contains dynamic segments. Query strings and hashes are omitted. Avoid user IDs, request payloads, headers, or free-form text in custom metric metadata. Use `metricName`, `metricIdFactory`, or `requestMetricEvent` when your app needs a different naming, description, or metadata policy. Set `captureRequests: false` with `captureRequestMetrics: true` when you only want the duration metric and not the request log/span.
216
216
 
217
217
  The wrapper expects App Router Route Handlers that return standard `Response` objects. It does not call `NextResponse.next()` and does not use the deprecated `middleware` filename. For Next.js 16 request interception, use the framework's `proxy.js` convention separately and keep LogBrew event creation in server-side route code.
218
218
 
package/client.cjs CHANGED
@@ -13,6 +13,7 @@ const DEFAULT_SDK_VERSION = "0.1.3";
13
13
  function createLogBrewNextBrowserClient({
14
14
  apiKey,
15
15
  clientKey,
16
+ context,
16
17
  eventFilter,
17
18
  sdkName = DEFAULT_SDK_NAME,
18
19
  sdkVersion = DEFAULT_SDK_VERSION,
@@ -26,6 +27,7 @@ function createLogBrewNextBrowserClient({
26
27
  }
27
28
  return LogBrewClient.create({
28
29
  apiKey: authKey,
30
+ context,
29
31
  eventFilter,
30
32
  maxQueueSize,
31
33
  maxRetries,
package/client.d.cts CHANGED
@@ -3,12 +3,14 @@ import type {
3
3
  EventFilter,
4
4
  LogBrewClient,
5
5
  Metadata,
6
- SpanAttributes
6
+ SpanAttributes,
7
+ TelemetryContext
7
8
  } from "@logbrew/sdk";
8
9
 
9
10
  export type CreateLogBrewNextBrowserClientConfig = {
10
11
  apiKey?: string;
11
12
  clientKey?: string;
13
+ context?: TelemetryContext;
12
14
  sdkName?: string;
13
15
  sdkVersion?: string;
14
16
  maxRetries?: number;
package/client.d.ts CHANGED
@@ -3,12 +3,14 @@ import type {
3
3
  EventFilter,
4
4
  LogBrewClient,
5
5
  Metadata,
6
- SpanAttributes
6
+ SpanAttributes,
7
+ TelemetryContext
7
8
  } from "@logbrew/sdk";
8
9
 
9
10
  export type CreateLogBrewNextBrowserClientConfig = {
10
11
  apiKey?: string;
11
12
  clientKey?: string;
13
+ context?: TelemetryContext;
12
14
  sdkName?: string;
13
15
  sdkVersion?: string;
14
16
  maxRetries?: number;
package/client.js CHANGED
@@ -13,6 +13,7 @@ const DEFAULT_SDK_VERSION = "0.1.3";
13
13
  export function createLogBrewNextBrowserClient({
14
14
  apiKey,
15
15
  clientKey,
16
+ context,
16
17
  eventFilter,
17
18
  sdkName = DEFAULT_SDK_NAME,
18
19
  sdkVersion = DEFAULT_SDK_VERSION,
@@ -26,6 +27,7 @@ export function createLogBrewNextBrowserClient({
26
27
  }
27
28
  return LogBrewClient.create({
28
29
  apiKey: authKey,
30
+ context,
29
31
  eventFilter,
30
32
  maxQueueSize,
31
33
  maxRetries,
package/index.cjs CHANGED
@@ -24,6 +24,7 @@ const activeTraceContext = new AsyncLocalStorage();
24
24
  function createLogBrewNextClient({
25
25
  apiKey,
26
26
  serverApiKey,
27
+ context,
27
28
  sdkName = DEFAULT_SDK_NAME,
28
29
  sdkVersion = DEFAULT_SDK_VERSION,
29
30
  maxRetries = 2
@@ -35,7 +36,7 @@ function createLogBrewNextClient({
35
36
  "createLogBrewNextClient requires serverApiKey, apiKey, LOGBREW_SERVER_API_KEY, or LOGBREW_API_KEY"
36
37
  );
37
38
  }
38
- return LogBrewClient.create({ apiKey: authKey, sdkName, sdkVersion, maxRetries });
39
+ return LogBrewClient.create({ apiKey: authKey, context, sdkName, sdkVersion, maxRetries });
39
40
  }
40
41
 
41
42
  function createLogBrewNextRequestErrorHandler(options = {}) {
@@ -221,6 +222,7 @@ function createRequestMetricEvent(request, response, {
221
222
  timestamp: now(),
222
223
  attributes: {
223
224
  name: metricName,
225
+ description: "Duration of one completed server request.",
224
226
  kind: "histogram",
225
227
  value: Math.max(0, Number(durationMs)),
226
228
  unit: "ms",
package/index.d.cts CHANGED
@@ -4,6 +4,7 @@ import type {
4
4
  LogBrewClient,
5
5
  MetricAttributes,
6
6
  SpanAttributes,
7
+ TelemetryContext,
7
8
  Transport,
8
9
  TransportResponse
9
10
  } from "@logbrew/sdk";
@@ -17,6 +18,7 @@ type NodeFetchTransportConfig = {
17
18
  export type CreateLogBrewNextClientConfig = {
18
19
  apiKey?: string;
19
20
  serverApiKey?: string;
21
+ context?: TelemetryContext;
20
22
  sdkName?: string;
21
23
  sdkVersion?: string;
22
24
  maxRetries?: number;
package/index.d.ts CHANGED
@@ -4,6 +4,7 @@ import type {
4
4
  LogBrewClient,
5
5
  MetricAttributes,
6
6
  SpanAttributes,
7
+ TelemetryContext,
7
8
  Transport,
8
9
  TransportResponse
9
10
  } from "@logbrew/sdk";
@@ -17,6 +18,7 @@ type NodeFetchTransportConfig = {
17
18
  export type CreateLogBrewNextClientConfig = {
18
19
  apiKey?: string;
19
20
  serverApiKey?: string;
21
+ context?: TelemetryContext;
20
22
  sdkName?: string;
21
23
  sdkVersion?: string;
22
24
  maxRetries?: number;
package/index.js CHANGED
@@ -24,6 +24,7 @@ const activeTraceContext = new AsyncLocalStorage();
24
24
  export function createLogBrewNextClient({
25
25
  apiKey,
26
26
  serverApiKey,
27
+ context,
27
28
  sdkName = DEFAULT_SDK_NAME,
28
29
  sdkVersion = DEFAULT_SDK_VERSION,
29
30
  maxRetries = 2
@@ -35,7 +36,7 @@ export function createLogBrewNextClient({
35
36
  "createLogBrewNextClient requires serverApiKey, apiKey, LOGBREW_SERVER_API_KEY, or LOGBREW_API_KEY"
36
37
  );
37
38
  }
38
- return LogBrewClient.create({ apiKey: authKey, sdkName, sdkVersion, maxRetries });
39
+ return LogBrewClient.create({ apiKey: authKey, context, sdkName, sdkVersion, maxRetries });
39
40
  }
40
41
 
41
42
  export function createLogBrewNextRequestErrorHandler(options = {}) {
@@ -221,6 +222,7 @@ export function createRequestMetricEvent(request, response, {
221
222
  timestamp: now(),
222
223
  attributes: {
223
224
  name: metricName,
225
+ description: "Duration of one completed server request.",
224
226
  kind: "histogram",
225
227
  value: Math.max(0, Number(durationMs)),
226
228
  unit: "ms",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logbrew/next",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Next.js App Router helpers for the public LogBrew JavaScript SDK.",
5
5
  "type": "module",
6
6
  "main": "./index.cjs",
@@ -91,7 +91,7 @@
91
91
  },
92
92
  "peerDependencies": {
93
93
  "@logbrew/node": "^0.1.2",
94
- "@logbrew/sdk": "^0.1.3",
94
+ "@logbrew/sdk": "^0.1.12",
95
95
  "next": ">=15",
96
96
  "react": ">=18",
97
97
  "react-dom": ">=18"