Code Monkey home page Code Monkey logo

telemetry_registry's People

Contributors

aaronrenner avatar bryannaegele avatar davydog187 avatar hauleth avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

telemetry_registry's Issues

Proposal: telemetry event definitions

Background

Users currently rely on discovery and documentation of telemetry events in two manners: reading source code and documentation. To make use of events users must have an understanding of the following:

  • event name
  • available measurements
  • available metadata

The general pattern in use today which we've iterated towards in Elixir is:

  • [:my_event, :name] - general description of what the event is
    • Measurement: %{map_of: pseudo_type_spec}
    • Metadata: %{map_of: pseudo_type_spec}

This has worked fairly well for most users I've interacted with, so we should build on this as a starting point to support documentation and discovery.

Proposal

Telemetry module event attributes should support an event definition map, in addition to a plain event, such as [my_app, event, stop] to provide a standard for documentation which can be leveraged by tools like ex_doc

Example

-telemetry_event([my_app, some, event]).
-telemetry_event(#{
    event => [my_app, event, stop],
    description => "A description of the event",
    measurement => "`#{duration => non_neg_integer()}`",
    metadata => "`#{status => 200 | 400 | 404, method => string()}`"
}).

Plain events would be stored with empty string defaults for the other properties of a definition.

Discussion

While it would be nifty to use actual typespecs for the measurement and metadata, I'm unfamiliar with any way to accomplish that, especially cross-language. If there isn't a way to leverage typespecs, a plain string with the user using a single-line code block of pseduo-typespec feels sufficient. The primary use case for the measurement and metadata information is to inform users of what is available.

Status: Accepted

Add magic method between TelemetryRegistry.get_events/1 and Module.get_attribute/3

I'd love to make TelemetryDecorator event names easier to discover (amplifiedai/telemetry_decorator#2). Assuming I can figure out a way to emit module-level AST chunks (arjan/decorator#42), the next trick will be making the dependency on TelemetryRegistry optional. Strikes me registering the attribute myself is rude, which might introduce a race. Bah!

If your macro defined a José-style magic method eg. __telemetry_registry_details__/0 in the module exposing the results of Module.get_attribute/3, though, I could do the same in an API-compatible way using my own attribute. We'd each have to check Module.defines?(__MODULE__, {: __telemetry_registry_details__, 0}) and defoverridable __telemetry_registry_details__: 0 if so, bu— this is getting silly; maybe I should just invoke your macro. Thoughts?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.