Skip to content
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

update protos #139

Merged
merged 3 commits into from
Nov 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 2 additions & 16 deletions apps/opentelemetry_api/include/opentelemetry.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -75,20 +75,6 @@
message :: unicode:unicode_binary()
}).

-define(OTEL_STATUS_UNSET, 'Unset').
-define(OTEL_STATUS_OK, 'Ok').
-define(OTEL_STATUS_CANCELLED, 'Cancelled').
-define(OTEL_STATUS_UNKNOWN, 'UnknownError').
-define(OTEL_STATUS_INVALID_ARGUMENT, 'InvalidArgument').
-define(OTEL_STATUS_DEADLINE_EXCEEDED, 'DeadlineExceeded').
-define(OTEL_STATUS_NOT_FOUND, 'NotFound').
-define(OTEL_STATUS_ALREADY_EXISTS , 'AlreadyExists').
-define(OTEL_STATUS_PERMISSION_DENIED, 'PermissionDenied').
-define(OTEL_STATUS_RESOURCE_EXHAUSTED, 'ResourceExhausted').
-define(OTEL_STATUS_FAILED_PRECONDITION, 'FailedPrecondition').
-define(OTEL_STATUS_ABORTED, 'Aborted').
-define(OTEL_STATUS_OUT_OF_RANGE, 'OutOfRange').
-define(OTEL_STATUS_UNIMPLEMENTED, 'Unimplemented').
-define(OTEL_STATUS_INTERNAL, 'InternalError').
-define(OTEL_STATUS_UNAVAILABLE, 'Unavailable').
-define(OTEL_STATUS_DATA_LOSS, 'DataLoss').
-define(OTEL_STATUS_UNAUTHENTICATED, 'Unauthenticated').
-define(OTEL_STATUS_ERROR, 'Error').
4 changes: 3 additions & 1 deletion apps/opentelemetry_api/src/opentelemetry.erl
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
event_name/0,
tracestate/0,
status/0,
status_code/0,
resource/0,
text_map/0]).

Expand Down Expand Up @@ -114,6 +115,7 @@
-type link() :: #link{}.
-type links() :: [#link{}].
-type status() :: #status{}.
-type status_code() :: ?OTEL_STATUS_UNSET | ?OTEL_STATUS_OK | ?OTEL_STATUS_ERROR.

%% The key must begin with a lowercase letter, and can only contain
%% lowercase letters 'a'-'z', digits '0'-'9', underscores '_', dashes
Expand Down Expand Up @@ -324,7 +326,7 @@ events(List) ->
end, List).

-spec status(Code, Message) -> status() | undefined when
Code :: atom(),
Code :: status_code(),
Message :: unicode:unicode_binary().
status(Code, Message) when is_atom(Code),
is_binary(Message) ->
Expand Down
106 changes: 0 additions & 106 deletions apps/opentelemetry_api/src/otel_http_status.erl

This file was deleted.

1 change: 0 additions & 1 deletion apps/opentelemetry_api/src/otel_tracer_provider.erl
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ resource() ->
undefined
end.


-spec register_tracer(atom(), string()) -> boolean().
register_tracer(Name, Vsn) ->
try
Expand Down
4 changes: 2 additions & 2 deletions apps/opentelemetry_api/test/opentelemetry_api_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ update_span_data(_Config) ->

Events = opentelemetry:events([{opentelemetry:timestamp(),
<<"timed-event-name">>, []}]),
Status = otel_http_status:to_status(200),
?assertMatch(#status{code = ?OTEL_STATUS_OK, message = <<"Ok">>}, Status),
Status = opentelemetry:status(?OTEL_STATUS_OK, <<"This is Ok">>),
?assertMatch(#status{code = ?OTEL_STATUS_OK, message = <<"This is Ok">>}, Status),

otel_span:set_status(SpanCtx1, Status),
otel_span:add_events(SpanCtx1, Events),
Expand Down
36 changes: 4 additions & 32 deletions apps/opentelemetry_exporter/src/opentelemetry_exporter.erl
Original file line number Diff line number Diff line change
Expand Up @@ -243,37 +243,9 @@ to_otlp_kind(_) ->
'SPAN_KIND_UNSPECIFIED'.

-spec to_otlp_status(atom()) -> opentelemetry_exporter_trace_service_pb:'span.StatusCode'().
to_otlp_status(?OTEL_STATUS_UNSET) ->
'STATUS_CODE_UNSET';
to_otlp_status(?OTEL_STATUS_OK) ->
'STATUS_CODE_OK';
to_otlp_status(?OTEL_STATUS_CANCELLED) ->
'STATUS_CODE_CANCELLED';
to_otlp_status(?OTEL_STATUS_UNKNOWN) ->
'STATUS_CODE_UNKNOWN_ERROR';
to_otlp_status(?OTEL_STATUS_INVALID_ARGUMENT) ->
'STATUS_CODE_INVALID_ARGUMENT';
to_otlp_status(?OTEL_STATUS_DEADLINE_EXCEEDED) ->
'STATUS_CODE_DEADLINE_EXCEEDED';
to_otlp_status(?OTEL_STATUS_NOT_FOUND) ->
'STATUS_CODE_NOT_FOUND';
to_otlp_status(?OTEL_STATUS_ALREADY_EXISTS) ->
'STATUS_CODE_ALREADY_EXISTS';
to_otlp_status(?OTEL_STATUS_PERMISSION_DENIED) ->
'STATUS_CODE_PERMISSION_DENIED';
to_otlp_status(?OTEL_STATUS_RESOURCE_EXHAUSTED) ->
'STATUS_CODE_RESOURCE_EXHAUSTED';
to_otlp_status(?OTEL_STATUS_FAILED_PRECONDITION) ->
'STATUS_CODE_FAILED_PRECONDITION';
to_otlp_status(?OTEL_STATUS_ABORTED) ->
'STATUS_CODE_ABORTED';
to_otlp_status(?OTEL_STATUS_OUT_OF_RANGE) ->
'STATUS_CODE_OUT_OF_RANGE';
to_otlp_status(?OTEL_STATUS_UNIMPLEMENTED) ->
'STATUS_CODE_UNIMPLEMENTED';
to_otlp_status(?OTEL_STATUS_INTERNAL) ->
'STATUS_CODE_INTERNAL_ERROR';
to_otlp_status(?OTEL_STATUS_UNAVAILABLE) ->
'STATUS_CODE_UNAVAILABLE';
to_otlp_status(?OTEL_STATUS_DATA_LOSS) ->
'STATUS_CODE_DATA_LOSS';
to_otlp_status(?OTEL_STATUS_UNAUTHENTICATED) ->
'STATUS_CODE_UNAUTHENTICATED'.
to_otlp_status(?OTEL_STATUS_ERROR) ->
'STATUS_CODE_ERROR'.
Loading