Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
1 line
3.8 KiB
Plaintext
1 line
3.8 KiB
Plaintext
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../../src/v4-v5/utils.ts"],"names":[],"mappings":";;;AAgBA,8EAI6C;AAC7C,wCAOoB;AACpB,oEAAkE;AAElE,SAAgB,mBAAmB,CACjC,IAAgB,EAChB,OAAY,EACZ,gBAAkC;IAElC,MAAM,UAAU,GAAe,EAAE,CAAC;IAElC,IAAI,gBAAgB,GAAG,kCAAgB,CAAC,GAAG,EAAE;QAC3C,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;YACxB,CAAC,wBAAc,CAAC,EAAE,+BAAqB;YACvC,CAAC,4BAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;YAC3C,CAAC,4BAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;YAC3C,CAAC,mCAAyB,CAAC,EACzB,gDAAgD,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,CAAC;SACvE,CAAC,CAAC;KACJ;IAED,IAAI,gBAAgB,GAAG,kCAAgB,CAAC,MAAM,EAAE;QAC9C,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;YACxB,CAAC,0CAAmB,CAAC,EAAE,oCAA0B;YACjD,CAAC,0CAAmB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;YAC5C,CAAC,uCAAgB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI;SAC1C,CAAC,CAAC;KACJ;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AA1BD,kDA0BC;AAED;;;;;;GAMG;AACH,SAAS,gDAAgD,CACvD,IAAgB,EAChB,GAAa;IAEb,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,CAAC,GAAG,EAAE;QACnC,OAAO;KACR;IAED,IAAI;QACF,MAAM,CAAC,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QAClC,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC;QAChB,CAAC,CAAC,QAAQ,GAAG,EAAE,CAAC;QAChB,OAAO,CAAC,CAAC,IAAI,CAAC;KACf;IAAC,OAAO,GAAG,EAAE;QACZ,IAAI,CAAC,KAAK,CAAC,yCAAyC,EAAE,GAAG,CAAC,CAAC;KAC5D;IACD,OAAO;AACT,CAAC","sourcesContent":["/*\n * Copyright The OpenTelemetry Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Attributes, DiagLogger } from '@opentelemetry/api';\nimport {\n ATTR_DB_SYSTEM_NAME,\n ATTR_SERVER_ADDRESS,\n ATTR_SERVER_PORT,\n} from '@opentelemetry/semantic-conventions';\nimport {\n ATTR_DB_SYSTEM,\n ATTR_DB_CONNECTION_STRING,\n ATTR_NET_PEER_NAME,\n ATTR_NET_PEER_PORT,\n DB_SYSTEM_VALUE_REDIS,\n DB_SYSTEM_NAME_VALUE_REDIS,\n} from '../semconv';\nimport { SemconvStability } from '@opentelemetry/instrumentation';\n\nexport function getClientAttributes(\n diag: DiagLogger,\n options: any,\n semconvStability: SemconvStability\n): Attributes {\n const attributes: Attributes = {};\n\n if (semconvStability & SemconvStability.OLD) {\n Object.assign(attributes, {\n [ATTR_DB_SYSTEM]: DB_SYSTEM_VALUE_REDIS,\n [ATTR_NET_PEER_NAME]: options?.socket?.host,\n [ATTR_NET_PEER_PORT]: options?.socket?.port,\n [ATTR_DB_CONNECTION_STRING]:\n removeCredentialsFromDBConnectionStringAttribute(diag, options?.url),\n });\n }\n\n if (semconvStability & SemconvStability.STABLE) {\n Object.assign(attributes, {\n [ATTR_DB_SYSTEM_NAME]: DB_SYSTEM_NAME_VALUE_REDIS,\n [ATTR_SERVER_ADDRESS]: options?.socket?.host,\n [ATTR_SERVER_PORT]: options?.socket?.port,\n });\n }\n\n return attributes;\n}\n\n/**\n * removeCredentialsFromDBConnectionStringAttribute removes basic auth from url and user_pwd from query string\n *\n * Examples:\n * redis://user:pass@localhost:6379/mydb => redis://localhost:6379/mydb\n * redis://localhost:6379?db=mydb&user_pwd=pass => redis://localhost:6379?db=mydb\n */\nfunction removeCredentialsFromDBConnectionStringAttribute(\n diag: DiagLogger,\n url?: unknown\n): string | undefined {\n if (typeof url !== 'string' || !url) {\n return;\n }\n\n try {\n const u = new URL(url);\n u.searchParams.delete('user_pwd');\n u.username = '';\n u.password = '';\n return u.href;\n } catch (err) {\n diag.error('failed to sanitize redis connection url', err);\n }\n return;\n}\n"]} |