emqx_external_trace.hrl 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. %%--------------------------------------------------------------------
  2. %% Copyright (c) 2019-2024 EMQ Technologies Co., Ltd. All Rights Reserved.
  3. %%
  4. %% Licensed under the Apache License, Version 2.0 (the "License");
  5. %% you may not use this file except in compliance with the License.
  6. %% You may obtain a copy of the License at
  7. %%
  8. %% http://www.apache.org/licenses/LICENSE-2.0
  9. %%
  10. %% Unless required by applicable law or agreed to in writing, software
  11. %% distributed under the License is distributed on an "AS IS" BASIS,
  12. %% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. %% See the License for the specific language governing permissions and
  14. %% limitations under the License.
  15. %%--------------------------------------------------------------------
  16. -ifndef(EMQX_EXT_TRACE_HRL).
  17. -define(EMQX_EXT_TRACE_HRL, true).
  18. %% --------------------------------------------------------------------
  19. %% Macros
  20. -define(ATTRS_META, attrs_meta).
  21. -define(EXT_TRACE_ATTRS_META(Meta),
  22. {emqx_ext_trace, ?ATTRS_META, Meta}
  23. ).
  24. -define(ext_trace_add_attrs(ATTRS_OR_META),
  25. emqx_external_trace:add_span_attrs(ATTRS_OR_META)
  26. ).
  27. -define(ext_trace_add_event(EVENT_NAME, TRACE_ATTRS),
  28. emqx_external_trace:add_span_event(EVENT_NAME, TRACE_ATTRS)
  29. ).
  30. -define(EXT_TRACE_START, '$ext_trace_start').
  31. -define(EXT_TRACE_STOP, '$ext_trace_stop').
  32. %% --------------------------------------------------------------------
  33. %% types
  34. -type attrs() :: #{atom() => _}.
  35. -type attrs_meta() :: {emqx_ext_trace, ?ATTRS_META, any()}.
  36. -type event_name() :: opentelemetry:event_name().
  37. -endif.