-
Notifications
You must be signed in to change notification settings - Fork 79
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b690447
commit d4578ad
Showing
8 changed files
with
49 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
from random import Random | ||
from typing import Callable | ||
|
||
def ulid(random: Random, ms_timestamp_generator: Callable[[], int]) -> int: | ||
"""Generate an integer ULID compatible with UUID v4. | ||
ULIDs as defined by the [spec](https://github.com/ulid/spec) look like this: | ||
01AN4Z07BY 79KA1307SR9X4MV3 | ||
|----------| |----------------| | ||
Timestamp Randomness | ||
48bits 80bits | ||
In the future it would be nice to make this compatible with a UUID, | ||
e.g. v4 UUIDs by setting the version and variant bits correctly. | ||
We can't currently do this because setting these bits would leave us with only 7 bytes of randomness, | ||
which isn't enough for the Python SDK's sampler that currently expects 8 bytes of randomness. | ||
In the future OTEL will probably adopt https://www.w3.org/TR/trace-context-2/#random-trace-id-flag | ||
which relies only on the lower 7 bytes of the trace ID, then all SDKs and tooling should be updated | ||
and leaving only 7 bytes of randomness should be fine. | ||
Right now we only care about: | ||
- Our SDK / Python SDK's in general. | ||
- The OTEL collector. | ||
And both behave properly with 8 bytes of randomness because trace IDs were originally 64 bits | ||
so to be compatible with old trace IDs nothing in OTEL can assume >8 bytes of randomness in trace IDs | ||
unless they generated the trace ID themselves (e.g. the Go SDK _does_ expect >8 bytes of randomness internally). | ||
""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build" | |
|
||
[project] | ||
name = "logfire-api" | ||
version = "3.0.0" | ||
version = "3.1.0" | ||
description = "Shim for the Logfire SDK which does nothing unless Logfire is installed" | ||
authors = [ | ||
{ name = "Pydantic Team", email = "[email protected]" }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.