apple / swift-distributed-tracing-baggage Goto Github PK
View Code? Open in Web Editor NEWMinimal type-safe context propagation container
Home Page: https://github.com/apple/swift-distributed-tracing
License: Apache License 2.0
Minimal type-safe context propagation container
Home Page: https://github.com/apple/swift-distributed-tracing
License: Apache License 2.0
This mirrors the slashmo/gsoc-swift-baggage-context#35 ticket
--
Additional capability similar to privacy in os_log to be added to baggage keys.
A key has to define if it wants to be included in forEach and if it wants to be logged.
[...] mark a key as containing sensitive information . for example, you may have a key that carries sensitive user information and that you never want the collectors to log
via @tomerd
This package produces a library called Baggage
.
The library Baggage
uses @_exported import CoreBaggage
.
CoreBaggage
has a struct Baggage
.
For this reason it is not possible to use the Baggage
namespace. The compiler will always detect Baggage
as the struct form CoreBaggage
.
Failing code:
import Baggage
extension Lambda.Context: Baggage.LoggingContext {}
Produces the compile error: 'LoggingContext' is not a member of struct 'CoreBaggage.Baggage'.
This commit required that types confirming to BaggageKey
are now Sendable
on Swift 5.5+.
That change obviously makes sense but unfortunately, it's source breaking...
That's fine by SemVer (because this package is version 0.x) but probably still an issue.
swift --version
swift-driver version: 1.26.9 Apple Swift version 5.5 (swiftlang-1300.0.31.1 clang-1300.0.29.1)
Target: x86_64-apple-macosx11.0
swift build
/xxx/swift-distributed-tracing-baggage/Sources/InstrumentationBaggage/Baggage.swift:232:5: error: unknown attribute 'TaskLocal'
@TaskLocal public static var current: Baggage?
^
[2/2] Compiling InstrumentationBaggage BaggageKey.swift
Additional steps/requirements like extra compilation flags described in README.md
and, if possible, included in the manifest file Package.swift
.
The Baggage
type is useful more widely than just (distributed) tracing & instrumentation. We should seriously consider renaming repo & module. Systems like swift-llbuild2 currently use a (very bad) definition of Context
because you need to be able to pass data "through" the llbuild2 build engine itself (as you, the user construct the build graph as well as execute the individual build steps).
Need to bring in slashmo/gsoc-swift-baggage-context#34 from the repo over here and ensure all types are proper.
In the future, Logging should be handled elsewhere.
The reason for splitting up Baggage into two repositories, Baggage
and BaggageCore
was to have one "pure" library without the Logging
dependency which others could depend on. Because the Logging
dependency will be dropped from this repo, we can also get rid of baggage-core
altogether and instead put its source files into this repo.
If I call either Baggage.$current.withValue
or Baggage.withValue
from an actor where the closure accesses the same actor I get different results. The first compiles fine and the second errors with the following
non-sendable type '() async throws -> ()' exiting actor-isolated context in call to non-isolated static method 'withValue(_:operation:)' cannot cross actor boundary
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.