Skip to content

Commit

Permalink
deps
Browse files Browse the repository at this point in the history
  • Loading branch information
jessitron committed Jan 11, 2025
1 parent 413a0ba commit 49f5649
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion public/hny.js
Original file line number Diff line number Diff line change
Expand Up @@ -21242,7 +21242,7 @@ var $8d2dec6b2f42fe45$export$d1d5ca1ca02801e6 = "url.scheme";
var $8d2dec6b2f42fe45$export$11d4f8ef7be26b3d = "user_agent.original";


const $c9f3acea5fa71cd0$var$MY_VERSION = "0.10.34";
const $c9f3acea5fa71cd0$var$MY_VERSION = "0.10.35";
function $c9f3acea5fa71cd0$var$initializeTracing(params /* { apiKey: string, serviceName: string } */ ) {
if (!params) params = {};
if (!params.apiKey) throw new Error("Usage: initializeTracing({ apiKey: 'honeycomb api key', serviceName: 'name of this service' })");
Expand Down Expand Up @@ -21358,6 +21358,7 @@ async function $c9f3acea5fa71cd0$var$inSpanAsync(inputTracer, spanName, fn, cont
}
function $c9f3acea5fa71cd0$var$recordException(exception, additionalAttributes) {
const span = (0, $d3d11f3bc96c5059$export$357889f174732d38).getActiveSpan();
if (!span) return;
// I took this from the sdk-trace-base, except I'm gonna support additional attributes.
// https://github.com/open-telemetry/opentelemetry-js/blob/90afa2850c0690f7a18ecc511c04927a3183490b/packages/opentelemetry-sdk-trace-base/src/Span.ts#L321
const attributes = {};
Expand Down
15 changes: 12 additions & 3 deletions public/htmx.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var htmx = (function () {

// Requires version 0.10.33 or greater of jessitron/hny-otel-web, separately initialized.
// @ts-ignore
const INSTRUMENTATION_VERSION = "0.0.68";
const INSTRUMENTATION_VERSION = "0.0.73";

const HnyOtelWeb = window.Hny || {
emptySpan: { spanContext() {}, setAttributes() {} },
Expand Down Expand Up @@ -391,6 +391,12 @@ var htmx = (function () {

// JESS
function safeStringify(obj) {
if (obj === undefined) {
return "undefined";
}
if (obj === null) {
return "null";
}
try {
return JSON.stringify(obj);
} catch (e) {
Expand Down Expand Up @@ -5219,15 +5225,18 @@ var htmx = (function () {
}
);
};
xhr.onerror = function () {
xhr.onerror = function (event, event2) {
return HnyOtelWeb.inChildSpan(
HnyOtelWeb.INTERNAL_TRACER,
"xhr error received",
"communication failure",
issueAjaxRequestSpanContext,
() => {
HnyOtelWeb.setAttributes({
"htmx.request.path": responseInfo.pathInfo?.finalRequestPath,
"htmx.request-config": safeStringify(requestConfig),
"htmx.xhr.error": safeStringify(event),
"htmx.xhr.type": event.type,
"htmx.xhr.error2": safeStringify(event2),
});
removeRequestIndicators(indicators, disableElts);
triggerErrorEvent(elt, "htmx:afterRequest", responseInfo);
Expand Down

0 comments on commit 49f5649

Please sign in to comment.