Skip to content

Commit

Permalink
Merge pull request #4225 from systeminit/jobelenus/si-vue-observability
Browse files Browse the repository at this point in the history
Observability: ignore urls, create pinia-http-error
  • Loading branch information
jobelenus authored Jul 24, 2024
2 parents da38a23 + 758e1eb commit 21b2032
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
3 changes: 3 additions & 0 deletions app/web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ const sdk = new HoneycombWebSDK({
// load custom configuration for xml-http-request instrumentation
"@opentelemetry/instrumentation-xml-http-request": {
propagateTraceHeaderCorsUrls: backendHosts,
ignoreNetworkEvents: true,
ignoreUrls: [/^https:\/\/e\.systeminit\.com/],
},
"@opentelemetry/instrumentation-fetch": {
propagateTraceHeaderCorsUrls: backendHosts,
ignoreNetworkEvents: true,
ignoreUrls: [/^https:\/\/e\.systeminit\.com/],
},
}), // add automatic instrumentation
new DocumentLoadInstrumentation(),
Expand Down
1 change: 1 addition & 0 deletions lib/vue-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"dependencies": {
"@headlessui/tailwindcss": "^0.1.2",
"@headlessui/vue": "^1.7.10",
"@opentelemetry/api": "^1.8.0",
"@si/ts-lib": "workspace:*",
"@tailwindcss/forms": "^0.5.3",
"@tailwindcss/line-clamp": "^0.4.2",
Expand Down
11 changes: 11 additions & 0 deletions lib/vue-lib/src/pinia/pinia_api_tools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ import {
DeferredPromise,
} from "@si/ts-lib";
import { ulid } from "ulid";
import opentelemetry, { Span } from "@opentelemetry/api";

const tracer = opentelemetry.trace.getTracer("si-vue");

export type RequestUlid = string;

Expand Down Expand Up @@ -421,6 +424,14 @@ export const initPiniaApiToolkitPlugin = (config: { api: AxiosInstance }) => {
}

if (triggerResult.error) {
tracer.startActiveSpan("pinia-http-error", (span: Span) => {
span.setAttributes({
"http.body": JSON.stringify(actionResult.requestSpec.params),
"http.url": actionResult.requestSpec.url,
"http.status_code": triggerResult.error.response?.status,
});
span.end();
});
request.setFailedResult(triggerResult.error);
if (
actionName !== "SET_COMPONENT_GEOMETRY" &&
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 21b2032

Please sign in to comment.