@outputai/http 0.8.2-next.edf06bb.0 → 0.9.1-next.6fe398d.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/dist/cost.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { Tracing, Event } from '@outputai/core/sdk/runtime';
2
2
  import { requestIdSymbol } from './consts.js';
3
+ import { Logger } from '@outputai/core';
3
4
  /**
4
5
  * Attach cost information to the trace of an HTTP Request using the response
5
6
  *
@@ -10,7 +11,7 @@ import { requestIdSymbol } from './consts.js';
10
11
  export const addRequestCost = (response, value) => {
11
12
  const eventId = Reflect.get(response, requestIdSymbol);
12
13
  if (!eventId) {
13
- console.warn('addRequestCost(): The "response" argument did not originate from @outputai/http, no costs were added.');
14
+ Logger.warn('addRequestCost(): The "response" argument did not originate from @outputai/http, no costs were added.', { namespace: 'HTTP' });
14
15
  return;
15
16
  }
16
17
  const attribute = new Tracing.Attribute.HTTPRequestCost(response.url, eventId, value);
package/dist/cost.spec.js CHANGED
@@ -35,7 +35,6 @@ describe('addRequestCost', () => {
35
35
  beforeEach(() => {
36
36
  tracing.addEventAttribute.mockClear();
37
37
  event.emit.mockClear();
38
- vi.spyOn(console, 'warn').mockImplementation(() => { });
39
38
  });
40
39
  afterEach(() => {
41
40
  vi.restoreAllMocks();
@@ -44,7 +43,6 @@ describe('addRequestCost', () => {
44
43
  const response = new Response();
45
44
  const cost = 1;
46
45
  addRequestCost(response, cost);
47
- expect(console.warn).toHaveBeenCalledWith('addRequestCost(): The "response" argument did not originate from @outputai/http, no costs were added.');
48
46
  expect(tracing.addEventAttribute).not.toHaveBeenCalled();
49
47
  expect(event.emit).not.toHaveBeenCalled();
50
48
  });
@@ -53,7 +51,6 @@ describe('addRequestCost', () => {
53
51
  Reflect.set(response, requestIdSymbol, 'evt-cost-1');
54
52
  const cost = 2.5;
55
53
  addRequestCost(response, cost);
56
- expect(console.warn).not.toHaveBeenCalled();
57
54
  expect(tracing.addEventAttribute).toHaveBeenCalledWith({
58
55
  eventId: 'evt-cost-1',
59
56
  attribute: expect.objectContaining({
@@ -92,7 +89,6 @@ describe('addRequestCost', () => {
92
89
  addRequestIdToResponse(response, 'evt-clone-1');
93
90
  const cloned = response.clone();
94
91
  addRequestCost(cloned, 4.2);
95
- expect(console.warn).not.toHaveBeenCalled();
96
92
  expect(tracing.addEventAttribute).toHaveBeenCalledWith({
97
93
  eventId: 'evt-clone-1',
98
94
  attribute: expect.objectContaining({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@outputai/http",
3
- "version": "0.8.2-next.edf06bb.0",
3
+ "version": "0.9.1-next.6fe398d.0",
4
4
  "description": "Framework abstraction to make HTTP calls with tracing",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "ky": "1.14.3",
13
13
  "undici": "8.5.0",
14
- "@outputai/core": "0.8.2-next.edf06bb.0"
14
+ "@outputai/core": "0.9.1-next.6fe398d.0"
15
15
  },
16
16
  "license": "Apache-2.0",
17
17
  "publishConfig": {