-
Notifications
You must be signed in to change notification settings - Fork 795
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixing Span status when exporting span #1751
Changes from 6 commits
3a6a490
1c6efa2
902b3cb
ad16f71
42d7276
5253a72
45e763e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
+8 −0 | README.md | |
+81 −27 | opentelemetry/proto/trace/v1/trace.proto | |
+6 −6 | opentelemetry/proto/trace/v1/trace_config.proto |
+8 −0 | README.md | |
+81 −27 | opentelemetry/proto/trace/v1/trace.proto | |
+6 −6 | opentelemetry/proto/trace/v1/trace_config.proto |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,6 @@ | |
*/ | ||
|
||
import { SpanKind, Logger, Attributes } from '@opentelemetry/api'; | ||
import * as api from '@opentelemetry/api'; | ||
|
||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
export namespace opentelemetryProto { | ||
|
@@ -254,7 +253,32 @@ export namespace opentelemetryProto { | |
status?: Status; | ||
} | ||
|
||
export type Status = api.Status; | ||
export interface Status { | ||
/** The status code of this message. */ | ||
code: StatusCode; | ||
/** A developer-facing error message. */ | ||
message?: string; | ||
} | ||
|
||
/** | ||
* An enumeration of status codes. | ||
* https://github.com/open-telemetry/opentelemetry-proto/blob/master/opentelemetry/proto/trace/v1/trace.proto#L304 | ||
*/ | ||
export enum StatusCode { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we make this (and all enums) const? Again for better minification as during "compiliation" to JS, typescript converts all usages to the numeric value only. The downside is that if you have code to convert "string" names back to an the enum value its not possible without adding your own extra "lookups" |
||
/** | ||
* The default status. | ||
*/ | ||
UNSET = 0, | ||
/** | ||
* The operation has been validated by an Application developer or | ||
* Operator to have completed successfully. | ||
*/ | ||
OK = 1, | ||
/** | ||
* The operation contains an error. | ||
*/ | ||
ERROR = 2, | ||
} | ||
|
||
export interface TraceConfig { | ||
constantSampler?: ConstantSampler | null; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to directly test for undefined value instead of using
typeof
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not really, if message is set to anything I just pass it through, this is not validation but just checking if the message was set or not and then pass it through exactly as it was
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but to check it you are using
typeof
and then compare the result to a string'undefined'
.What is the benefit of it over testing directly for equality to undefined?