File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,10 +68,15 @@ export class HttpModule {
6868 }
6969
7070 private requestHeaders ( ) {
71- if ( this . method != "POST" ) return { } ;
71+ const headers = Client . client . headers ;
72+ const baseHeaders = {
73+ ...headers ,
74+ } ;
75+ if ( this . method !== "POST" ) return baseHeaders ;
7276 return {
7377 headers : {
7478 "Content-Type" : "application/json" ,
79+ ...baseHeaders ,
7580 } ,
7681 } ;
7782 }
Original file line number Diff line number Diff line change 1- const pkg = require ( "../package.json" ) ;
1+ // TODO:
2+ // const pkg = require("../package.json");
23
3- export const TRACEO_SDK_VERSION = pkg . version ;
4+ export const TRACEO_SDK_VERSION = "0.3.31" ;
Original file line number Diff line number Diff line change 11import { isEmpty } from "../core/is" ;
2+ import { TRACEO_SDK_VERSION } from "../core/version" ;
23import { TraceoOptions } from "../transport/options" ;
34import { Logger } from "./logger" ;
45import { MetricsProbe } from "./metrics" ;
56import { RuntimeData } from "./metrics/runtime-data" ;
67
78export class Client {
8- private options : TraceoOptions ;
9+ public headers : { [ key : string ] : any } ;
910
11+ private options : TraceoOptions ;
1012 private metricsProbe : MetricsProbe ;
1113 private runtimeData : RuntimeData ;
1214
@@ -16,6 +18,11 @@ export class Client {
1618 this . configGlobalClient ( ) ;
1719
1820 this . options = options ;
21+ this . headers = {
22+ "x-sdk-name" : "Node.js" ,
23+ "x-sdk-version" : TRACEO_SDK_VERSION ,
24+ "x-sdk-key" : this . options . apiKey ,
25+ } ;
1926 this . metricsProbe = new MetricsProbe ( this . options ) ;
2027
2128 this . logger = new Logger ( ) ;
Original file line number Diff line number Diff line change 11export interface TraceoOptions {
2- appId : number ;
2+ apiKey : string ;
3+ appId : string ;
34 offline ?: boolean ;
45 url : string ;
56 /*
Original file line number Diff line number Diff line change 11{
22 "name" : " traceo-sdk" ,
3- "version" : " 0.3.26 " ,
3+ "version" : " 0.3.31 " ,
44 "license" : " MIT" ,
55 "main" : " dist/index.js" ,
66 "types" : " dist/index.d.ts" ,
Original file line number Diff line number Diff line change @@ -5,7 +5,8 @@ describe("TraceClient", () => {
55 let client : Client ;
66
77 const clientOptions : TraceoOptions = {
8- appId : 35 ,
8+ apiKey : "sasdasdads" ,
9+ appId : "92873498234" ,
910 url : "/" ,
1011 collectMetrics : true ,
1112 scrapMetricsInterval : 15 ,
You can’t perform that action at this time.
0 commit comments