0.7.0 • Published 10 days ago

opentelemetry-instrumentation-remix v0.7.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
10 days ago

OpenTelemetry Remix Instrumentation for Node.js

NPM version Apache 2.0 License

This module provides automatic instrumentation for remix.

Installation

npm install --save opentelemetry-instrumentation-remix

Supported Versions

  • 1.1.0 - 2.x

Cloudflare Worker Warning

This instrumentation does NOT support Cloudflare Workers. For more details follow opentelemetry-js issue #1214.

Usage

For further automatic instrumentation instruction see the @opentelemetry/instrumentation package.

const { NodeTracerProvider } = require('@opentelemetry/sdk-trace-node');
const { registerInstrumentations } = require('@opentelemetry/instrumentation');
const { RemixInstrumentation } = require('opentelemetry-instrumentation-remix');

const tracerProvider = new NodeTracerProvider();
tracerProvider.register();

registerInstrumentations({
  instrumentations: [
    new RemixInstrumentation()
  ]
});

Configuration

NameTypeDefault ValueDescription
actionFormDataAttributesRecord<string, boolean | string>{ _action: "actionType" }Mapping of FormData field to span attribute names.
legacyErrorAttributesbooleanfalseWhether to emit errors in the form of span attributes, as well as in span exception events.

Instrumentation

requestHandler

Emitted for every request into remix server.

OperationExampleNotes
remix.request [routePath]remix.request /jokes/:jokeIdIf the request does not match a route, the name of the span will be remix.request
AttributeDescriptionExample Value
code.functionName of executed function"requestHandler"
http.methodHTTP method"POST"
http.urlHTTP URL"https://remix.jokes/jokes/new?_data=routes%2Fjokes%2Fnew"
http.routeHTTP route path, added if the request matches a route"/jokes/:jokeId"
http.status_codeResponse status code200
match.route.idRemix matched route ID, added if the request matches a route"routes/jokes/$jokeId"
errorAdded if error detected and if legacyErrorAttributes enabledtrue
exception.messageError message, if legacyErrorAttributes enabled and if applicable"Kaboom!"
exception.stacktraceError stacktrace, if legacyErrorAttributes enabled and if applicablestacktrace
Status CodeDescription
SpanStatusCode.ERRORWhen an exception occurs during evaluation
EventAttributesDescription
Exceptionexception.messageError message, if applicable
exception.stacktraceError stacktrace, if applicable

loader

Emitted for every loader called.

OperationExample
LOADER [routeId]LOADER routes/jokes/$jokeId
AttributeDescriptionExample Value
code.functionName of executed function"loader"
http.methodHTTP method"POST"
http.urlHTTP URL"https://remix.jokes/jokes/new?_data=routes%2Fjokes%2Fnew"
http.status_codeResponse status code200
match.route.idRemix matched route id"routes/jokes/$jokeId"
match.params.[paramName]Value for each remix matched param[match.params.jokeId]: 23fc7bcf-2d35-4c70-877f-338eca1fd3ef"
errorAdded if error detected and if legacyErrorAttributes enabledtrue
exception.messageError message, if legacyErrorAttributes enabled and if applicable"Kaboom!"
exception.stacktraceError stacktrace, if legacyErrorAttributes enabled and if applicablestacktrace
Status CodeDescription
SpanStatusCode.ERRORWhen an exception occurs during evaluation
EventAttributesDescription
Exceptionexception.messageError message, if applicable
exception.stacktraceError stacktrace, if applicable

action

Emitted for every action called.

OperationExample
ACTION [routeId]ACTION routes/jokes/new
AttributeDescriptionExample Value
code.functionName of executed function"action"
http.methodHTTP method"POST"
http.urlHTTP URL"https://remix.jokes/jokes/new?_data=routes%2Fjokes%2Fnew"
http.status_codeResponse status code200
match.route.idRemix matched route id"routes/jokes/$jokeId"
match.params.[paramName]Value for each remix matched param[match.params.jokeId]: "23fc7bcf-2d35-4c70-877f-338eca1fd3ef"
formData.[fieldName]Value for each configured FormData field[formData.actionType]: "createJoke"
errorAdded if error detected and if legacyErrorAttributes enabledtrue
exception.messageError message, if legacyErrorAttributes enabled and if applicable"Kaboom!"
exception.stacktraceError stacktrace, if legacyErrorAttributes enabled and if applicablestacktrace
Status CodeDescription
SpanStatusCode.ERRORWhen an exception occurs during evaluation
EventAttributesDescription
Exceptionexception.messageError message, if applicable
exception.stacktraceError stacktrace, if applicable

License

Apache 2.0 - See LICENSE for more information.

0.7.0

10 days ago

0.6.0

7 months ago

0.5.2

8 months ago

0.5.1

8 months ago

0.5.0

9 months ago

0.4.0

10 months ago

0.3.0

1 year ago

0.2.0

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.3

2 years ago

0.0.2

2 years ago