From d8d5556f1ab2632c518d2203d3a6ba6d158f7772 Mon Sep 17 00:00:00 2001 From: Simon Larsen Date: Sun, 12 Nov 2023 14:24:27 +0000 Subject: [PATCH] add header setter --- Common/Types/Icon/IconProp.ts | 1 + .../src/Components/EmptyState/EmptyState.tsx | 3 +- CommonUI/src/Components/Icon/Icon.tsx | 4 + Dashboard/src/Components/NavBar/NavBar.tsx | 4 +- .../Telemetry/Services/View/Traces/Index.tsx | 4 +- Examples/otel-dotnet/Program.cs | 2 + .../bin/Debug/net6.0/otel-dotnet.dll | Bin 13312 -> 13312 bytes .../bin/Debug/net6.0/otel-dotnet.pdb | Bin 21364 -> 21380 bytes .../obj/Debug/net6.0/otel-dotnet.dll | Bin 13312 -> 13312 bytes .../obj/Debug/net6.0/otel-dotnet.pdb | Bin 21364 -> 21380 bytes .../obj/staticwebassets.pack.sentinel | 4 + Ingestor/API/OTelIngest.ts | 111 +++++++++--------- OTelCollector/config.yaml | 9 ++ 13 files changed, 84 insertions(+), 58 deletions(-) diff --git a/Common/Types/Icon/IconProp.ts b/Common/Types/Icon/IconProp.ts index 149717e121..41826dd6f2 100644 --- a/Common/Types/Icon/IconProp.ts +++ b/Common/Types/Icon/IconProp.ts @@ -10,6 +10,7 @@ enum IconProp { Settings = 'Settings', Criteria = 'Criteria', Notification = 'Notification', + CursorArrowRays = 'CursorArrowRays', Cube = 'Cube', Squares = 'Squares', RectangleStack = 'RectangleStack', diff --git a/CommonUI/src/Components/EmptyState/EmptyState.tsx b/CommonUI/src/Components/EmptyState/EmptyState.tsx index 56cb989d12..9d152f1c07 100644 --- a/CommonUI/src/Components/EmptyState/EmptyState.tsx +++ b/CommonUI/src/Components/EmptyState/EmptyState.tsx @@ -8,6 +8,7 @@ export interface ComponentProps { icon: IconProp | undefined; footer?: ReactElement | undefined; id: string; + iconClassName?: string; } const EmptyState: FunctionComponent = ( @@ -20,7 +21,7 @@ const EmptyState: FunctionComponent = ( {props.icon && ( )} diff --git a/CommonUI/src/Components/Icon/Icon.tsx b/CommonUI/src/Components/Icon/Icon.tsx index ef31385db4..5b84805d91 100644 --- a/CommonUI/src/Components/Icon/Icon.tsx +++ b/CommonUI/src/Components/Icon/Icon.tsx @@ -162,6 +162,10 @@ const Icon: FunctionComponent = ({ d="M6 6.878V6a2.25 2.25 0 012.25-2.25h7.5A2.25 2.25 0 0118 6v.878m-12 0c.235-.083.487-.128.75-.128h10.5c.263 0 .515.045.75.128m-12 0A2.25 2.25 0 004.5 9v.878m13.5-3A2.25 2.25 0 0119.5 9v.878m0 0a2.246 2.246 0 00-.75-.128H5.25c-.263 0-.515.045-.75.128m15 0A2.25 2.25 0 0121 12v6a2.25 2.25 0 01-2.25 2.25H5.25A2.25 2.25 0 013 18v-6c0-.98.626-1.813 1.5-2.122" /> ); + } else if (icon === IconProp.CursorArrowRays) { + return getSvgWrapper( + + ); } else if (icon === IconProp.SquareStack) { return getSvgWrapper( = ( ), }} > - {/* = ( onClick={() => { forceHideMoreMenu(); }} - /> */} + /> = ( _props: PageComponentProps @@ -61,7 +63,7 @@ const ServiceDelete: FunctionComponent = ( ]} sideMenu={} > -
Traces
+ ); }; diff --git a/Examples/otel-dotnet/Program.cs b/Examples/otel-dotnet/Program.cs index 8726a956f6..061a41aee2 100644 --- a/Examples/otel-dotnet/Program.cs +++ b/Examples/otel-dotnet/Program.cs @@ -56,6 +56,8 @@ builder.Services.AddOpenTelemetry() opt.Endpoint = new Uri(endpoint); // Set headers in OTLP exporter opt.Headers = "oneuptime-service-token=0a00ebc0-7f39-11ee-ac8c-3fb43926b224"; + + } System.Console.WriteLine($"OTLP Exporter is using {opt.Protocol} protocol and endpoint {opt.Endpoint}"); diff --git a/Examples/otel-dotnet/bin/Debug/net6.0/otel-dotnet.dll b/Examples/otel-dotnet/bin/Debug/net6.0/otel-dotnet.dll index f562b82fdf888c08f9801539347858072a420cc0..a6f45c4a297633819b3a4b6f204f840d25c63ce8 100644 GIT binary patch delta 1883 zcmc&#U2GIp6#mZ4?sRwBo!z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b 100644 GIT binary patch delta 493 zcmeyejIm`oH9T0wXJffd2s?8Rf6Q#LCd<-vA^h`yT+3_kbij!v!G8!Ekl+btYv-gx9 zrojeeNttbq^WV#4)alIF`&5+?2pSuiT6Z$FsWWz-Wa=_!>@#Paz`@iU#@M!svFko# zcPFC`6VO9)oRb@aL{xm)7MnJO6>GFTXVK`a)g=JO0}3=9If2C`t4CX*Y2L`{8J zKnmGV6t)|K6bk2h$qInN$d8keA)1Lp3}gyeXAnqd1Vkso3KpOhJwhOz3}z{oQp`Y| zf{cs|vP>KtOj#@p@`8LE42BGhDwWKPjT?cg7+v&Kz?6pyGvfpw3s#^;b_T}6$-2P~ M91}Q1CvX4-0Q}8wj{pDw delta 462 zcmZo!&iG{+M{FdIY%rM~IZ72Nq`M2EqebY`gt+~8eibdC3T%3)CL6%>`gu#u$P>q3G zM1u{;k}}#H=f9W9u)~zG$3m462pSuiTGN?YuQGP*X6n>r?CE0ci)Lz$V{D6H?7Ya> zRn4f*1oV*H*!!YI`=S{b0QP=xA^-pY diff --git a/Examples/otel-dotnet/obj/Debug/net6.0/otel-dotnet.dll b/Examples/otel-dotnet/obj/Debug/net6.0/otel-dotnet.dll index f562b82fdf888c08f9801539347858072a420cc0..a6f45c4a297633819b3a4b6f204f840d25c63ce8 100644 GIT binary patch delta 1883 zcmc&#U2GIp6#mZ4?sRwBo!z!ef1rf6+ucsLY`gstTK+0f3k4cVyDcp?nu2XXBGb$k zlcu3t6cG|Znu{@-kO-O}KA4&{;XyzmQF$TpfgmwzXoN%!QADCb{5yAdiDKe2Gr4EJ z?|kRpd+xb+?@n!>+J5AKD^ZC7z?n z(uQ`V9@e11iOV4%S_TkvC!mSa+4?_esUBg7C^N}Y0(RVy*_ zXhBVp8D*SDc9Q*Oo%H9CYSl9^9Y8fR`@4bD zo=Q4PCcQ$g#>FTYDGW`j4F1#%u5~=UFsYa=sfBHY!+Mla>9-seU&+W?#RlPrwcM?R zhj^3c1q;m8oJYJBVxLx#cueMGwy{+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=CNp`ZX*UHqZHi=BRT|TjQjlQo!CuJ(<8gG}J!g`sSXYz28VE}YJV>Gr7?e^VbJ&|$ z=)^%O6{?e{14kq?jK)zSj0)p%w17)=WEE!VR|l|w^-?||@yokSbws#J0AX4GNZ+73 zBg|9N8Js7X;E2^i=ga0-aETvRJx{Ed>me29Osz11f2kd?4pmAoTqm7RtDSXCsvECC zz0nF6i6qnBPD=oP!#R@`Zot=SIj)j@JIQrfSX_oW(rv5}Z@?{HZ|TbTUi}%{iSrd^ z;FvOxdDyMq!*%-geQYU8`$gTxdSFFvWQayfkPWhIe&6EBnNcsZew0}cE?})X$tKvB zRQ?{QG`>yz{#cpSgLsg)+1?dhUb8LQk3lmYgARNLcCzcxOLG+a)xKtqE#|(&V&8ev zk#0fX8TWyo&Mr2Me!ewr>W8H-Vk-r1y)!u0`ySx4V)S5y-dVcwvqe1H@6;F5oiFA! zevdVMap?BqzSUiyn%)TRsQS^x2mF!Bq|y4&NRhJnp>@Z_hQe33Ts;?z((;GTn?lc> f$aAs_O}r>@kLOm-#?;~sJ)5bH*(!g>iE_g~lT1j? diff --git a/Examples/otel-dotnet/obj/Debug/net6.0/otel-dotnet.pdb b/Examples/otel-dotnet/obj/Debug/net6.0/otel-dotnet.pdb index ebe0878a8b1ff52db131c5ed9a2ec18c806c15cd..02b4d3abf584dd3c52a22a4e7999becba8dc282b 100644 GIT binary patch delta 493 zcmeyejIm`oH9T0wXJffd2s?8Rf6Q#LCd<-vA^h`yT+3_kbij!v!G8!Ekl+btYv-gx9 zrojeeNttbq^WV#4)alIF`&5+?2pSuiT6Z$FsWWz-Wa=_!>@#Paz`@iU#@M!svFko# zcPFC`6VO9)oRb@aL{xm)7MnJO6>GFTXVK`a)g=JO0}3=9If2C`t4CX*Y2L`{8J zKnmGV6t)|K6bk2h$qInN$d8keA)1Lp3}gyeXAnqd1Vkso3KpOhJwhOz3}z{oQp`Y| zf{cs|vP>KtOj#@p@`8LE42BGhDwWKPjT?cg7+v&Kz?6pyGvfpw3s#^;b_T}6$-2P~ M91}Q1CvX4-0Q}8wj{pDw delta 462 zcmZo!&iG{+M{FdIY%rM~IZ72Nq`M2EqebY`gt+~8eibdC3T%3)CL6%>`gu#u$P>q3G zM1u{;k}}#H=f9W9u)~zG$3m462pSuiTGN?YuQGP*X6n>r?CE0ci)Lz$V{D6H?7Ya> zRn4f*1oV*H*!!YI`=S{b0QP=xA^-pY diff --git a/Examples/otel-dotnet/obj/staticwebassets.pack.sentinel b/Examples/otel-dotnet/obj/staticwebassets.pack.sentinel index 70474cdc48..81879adc5b 100644 --- a/Examples/otel-dotnet/obj/staticwebassets.pack.sentinel +++ b/Examples/otel-dotnet/obj/staticwebassets.pack.sentinel @@ -16,3 +16,7 @@ 2.0 2.0 2.0 +2.0 +2.0 +2.0 +2.0 diff --git a/Ingestor/API/OTelIngest.ts b/Ingestor/API/OTelIngest.ts index 7e99b53a20..6ba7a0700d 100644 --- a/Ingestor/API/OTelIngest.ts +++ b/Ingestor/API/OTelIngest.ts @@ -22,9 +22,9 @@ import LogService from 'CommonServer/Services/LogService'; import ObjectID from 'Common/Types/ObjectID'; import { JSONArray, JSONObject } from 'Common/Types/JSON'; import OTelIngestService from '../Service/OTelIngest'; -import GlobalCache from 'CommonServer/Infrastructure/GlobalCache'; -import ServiceService from 'CommonServer/Services/ServiceService'; -import Service from 'Model/Models/Service'; +// import GlobalCache from 'CommonServer/Infrastructure/GlobalCache'; +// import ServiceService from 'CommonServer/Services/ServiceService'; +// import Service from 'Model/Models/Service'; // Load proto file for OTel @@ -72,63 +72,63 @@ router.use( // check header. - if (!req.headers['oneuptime-service-token']) { - throw new BadRequestException( - 'Missing header: oneuptime-service-token' - ); - } + // if (!req.headers['oneuptime-service-token']) { + // throw new BadRequestException( + // 'Missing header: oneuptime-service-token' + // ); + // } - const cachedServiceId: string | null = await GlobalCache.getString( - 'service-token', - req.headers['oneuptime-service-token'] as string - ); - const serviceProjectId: string | null = await GlobalCache.getString( - 'service-project-id', - req.headers['oneuptime-service-token'] as string - ); + // const cachedServiceId: string | null = await GlobalCache.getString( + // 'service-token', + // req.headers['oneuptime-service-token'] as string + // ); + // const serviceProjectId: string | null = await GlobalCache.getString( + // 'service-project-id', + // req.headers['oneuptime-service-token'] as string + // ); - if (!cachedServiceId || !serviceProjectId) { - // load from the database and set the cache. - const service: Service | null = await ServiceService.findOneBy({ - query: { - serviceToken: new ObjectID( - req.headers['oneuptime-service-token'] as string - ), - }, - select: { - _id: true, - projectId: true, - }, - props: { - isRoot: true, - }, - }); + // if (!cachedServiceId || !serviceProjectId) { + // // load from the database and set the cache. + // const service: Service | null = await ServiceService.findOneBy({ + // query: { + // serviceToken: new ObjectID( + // req.headers['oneuptime-service-token'] as string + // ), + // }, + // select: { + // _id: true, + // projectId: true, + // }, + // props: { + // isRoot: true, + // }, + // }); - if (!service) { - throw new BadRequestException('Invalid service token'); - } + // if (!service) { + // throw new BadRequestException('Invalid service token'); + // } - await GlobalCache.setString( - 'service-token', - req.headers['oneuptime-service-token'] as string, - service._id?.toString() as string - ); - await GlobalCache.setString( - 'service-project-id', - req.headers['oneuptime-service-token'] as string, - service.projectId?.toString() as string - ); + // await GlobalCache.setString( + // 'service-token', + // req.headers['oneuptime-service-token'] as string, + // service._id?.toString() as string + // ); + // await GlobalCache.setString( + // 'service-project-id', + // req.headers['oneuptime-service-token'] as string, + // service.projectId?.toString() as string + // ); - (req as OtelRequest).serviceId = service.id as ObjectID; - (req as OtelRequest).projectId = service.projectId as ObjectID; - } + // (req as OtelRequest).serviceId = service.id as ObjectID; + // (req as OtelRequest).projectId = service.projectId as ObjectID; + // } - (req as OtelRequest).serviceId = ObjectID.fromString( - cachedServiceId as string - ); - (req as OtelRequest).projectId = ObjectID.fromString( - serviceProjectId as string - ); + // (req as OtelRequest).serviceId = ObjectID.fromString( + // cachedServiceId as string + // ); + // (req as OtelRequest).projectId = ObjectID.fromString( + // serviceProjectId as string + // ); next(); } catch (err) { @@ -455,6 +455,9 @@ router.post( next: NextFunction ): Promise => { try { + + debugger; + logger.info('OTel Ingestor API called'); req.body = req.body.toJSON(); diff --git a/OTelCollector/config.yaml b/OTelCollector/config.yaml index e33239d4ce..adfdc57583 100644 --- a/OTelCollector/config.yaml +++ b/OTelCollector/config.yaml @@ -1,3 +1,10 @@ +extensions: + headers_setter: + headers: + - action: insert + key: oneuptime-service-token + from_context: oneuptime-service-token + processors: receivers: @@ -5,6 +12,7 @@ receivers: protocols: grpc: http: + include_metadata: true @@ -14,6 +22,7 @@ exporters: headers: {"Content-Type": "application/json"} service: + extensions: [ headers_setter ] pipelines: traces: receivers: [otlp]