dimitarvp

dimitarvp

What does this OpenTelemetry typespec mean?

When looking at OpenTelemetry’s docs on the types of attribute values, I stumbled upon this typespec:

    unicode:unicode_binary() |
    atom() |
    number() |
    boolean() |
    [unicode:unicode_binary() | atom() | float() | integer() | boolean()] |
    {unicode:unicode_binary() | atom() | float() | integer() | boolean()}.

Can somebody tell me what does the last one mean? Is it like “a tuple with a single element that can be of the following types”? Or does it mean a “a tuple with an arbitrary amount of elements, each of which can be of the following types”? Or is it something else?

Marked As Solved

tristan

tristan

Rebar3 Core Team

Hah, my bad, this is a mistake.

It should just be tuple() and isn’t able to define the types the tuple can contain.

Also Liked

trisolaran

trisolaran

I tried dyalizing it, and it looks like it means “a tuple with a single element that can be of the following types”. You don’t see single-element tuples that often.

dimitarvp

dimitarvp

What weirded me out is that the OpenTelemetry library even uses this syntax at all. Wondered if there’s more to it than I can see (and I ran it through dialyzer as well).

Last Post!

dimitarvp

dimitarvp

I see, thank you!

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
lanycrost
Hi everyone! I need implement if…else if…else condition from my elixir code, and anymore of this control flow structures not work proper...
New
mcarvalho
What is the difference between System.get_env and Application.get_env? For example, what are best practices to use one versus another.
New
alice
Hey, Just curious what are the main benefits of Elixir compared to Clojure? When is Elixir more useful than Clojure and vice versa? Th...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

Other popular topics Top

New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
JakeBecker
TL;DR: I’ve just released an implementation of Microsoft’s IDE-independent Language Server Protocol for Elixir. It adds language support ...
1144 54921 245
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

We're in Beta

About us Mission Statement