ccadllc / cedi-dtrace Goto Github PK
View Code? Open in Web Editor NEWProvides a functional API for tracing programs across system and network boundaries.
License: Apache License 2.0
Provides a functional API for tracing programs across system and network boundaries.
License: Apache License 2.0
Currently dtrace leans on it's underlying effect for stack safety, which works ok for effects like IO that provide it but even IO is inadequate for dtrace needs as even for map/ap operations, we need that suspension because of our Kleisli-like nature (with the TC => F[?] that represents a span). So we use a bunch of hacks which generally "work" but only with a bunch of implicit constraints. I labeled this an enhancement but its really fixing an underlying design flaw.
Disable parallel for scalastyle.
I don't think I've signed a CCAD CLA as specified here https://github.com/ccadllc/cedi-dtrace/blob/master/CONTRIBUTING
Can you email me the PDF for me to sign and send back to you?
Provide tests to validate the TC instance laws, using scalacheck and discipline.
Trying to use the current version with the newer cats libs versions (2.0) breaks around using parTraverse
methods and other parallel methods.
It would be very nice to update this project and continue using dtrace with newer cats libs.
Maybe somehow related to the previous issue when notes and ids were misconfigured
When recording traces noticed that once the parallel operation is used on spans startTime
gets set to some past value.
Thought that maybe timeUnit
gets misconfigured but doesn't seem to be an issue.
Here's some output of Trace (traceId
, startTime
, timeUnit
)
(08437b2120d84563aca69abb21cb11cc.cb2e8f22e93e9acd<:8304c1927248e81b,989495477311,MICROSECONDS)
(08437b2120d84563aca69abb21cb11cc.d6eb183e2d6020c6<:8304c1927248e81b,989495477485,MICROSECONDS)
(08437b2120d84563aca69abb21cb11cc.8304c1927248e81b<:7b32416c35daf7d9,1556858256813000,MICROSECONDS)
(08437b2120d84563aca69abb21cb11cc.7b32416c35daf7d9<:27e11df15d90203a,1556858256813000,MICROSECONDS)
(08437b2120d84563aca69abb21cb11cc.27e11df15d90203a<:47ead56bdca393c5,1556858256813000,MICROSECONDS)
First two correspond to 1970-01-12 10:51:35 +0000
(these were called with parTupled
) while other three 2019-05-03 04:37:36 +0000
Create a logging module (in the spirit of logstash) which emits the dtrace spans in an ECS compliant format
There is a sample header (and in compressed mode, flag) that indicates if the trace should be sampled (emitted). If present and set to 0, we should respect it and not emit traces originating from this origin. Also should provide the means of setting this for outbound traces.
There is no standard for http headers for distributed tracing, but the closest thing is X-B3 style headers . These are used by several products, such as Zipkin, http4s or istio. It would be good if cedi-trace supported these, at least the three that are identical: trace-id, parent-id, span-id. This would give cedi-trace interoperability with other products.
Examples of money headers vs. x-b3 headers:
X-MoneyTrace: trace-id=de305d54-75b4-431b-adb2-eb6b9e546013;parent-id=3285573610483682037;span-id=3285573610483682037
X-B3-TraceId: 463ac35c9f6413ad48485a3953bb6124
X-B3-ParentSpanId: 0020000000000001
X-B3-SpanId: a2fb4a1d1a96d312
What is the recommended way to use TraceT
with a service built using tagless final?
I think it can work, if the interpreters of your algebras are all based on TraceT
. However, I'd like to use typeclass constraints for the interpreters too.
Any tips?
there's a new compressed variant of b3: https://github.com/openzipkin/b3-propagation
It probably should be attempted on extract even when you expect typical b3. Up to you, though.
This impl might be similar enough to be handy! kamon-io/Kamon#550
Child spans are not emitted when using Parallel/NonEmptyParallel typeclasses to execute a trace - only the root spans are emitted (but repeated for each)
The current timing implementation uses Instant.now
, and the difference between them, to measure the processing time of a span.
This is problematic for a few reasons, Instant
is:
I think that for reliable timing, System.nanoTime
should be used instead.
As this is not in any way related to the current "human" time, it has to be stored in addition to the current time (I note also that both values are stored in the Comcast Money implementation).
I have a working version of this, if you'd like a PR.
Add modules to support injecting (on the client side) and extracting (on the server side) http headers to propagate traces over http (via either / both b3 and money formatted headers). This will support / is related to #19
Could need to provide an alternative reference emitter and split out the TC instances that have differing implementations for jvm and js.
Trying to replicate an issue we came up with this example
scala> (1 to 100000).toVector.parTraverse(_ => TraceIO.unit).toIO.unsafeRunSync
java.lang.StackOverflowError
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:447)
at java.lang.StringBuilder.append(StringBuilder.java:136)
at java.lang.StringBuilder.append(StringBuilder.java:131)
at com.ccadllc.cedi.dtrace.TraceSystem$Timer$RealTime.<init>(TraceSystem.scala:146)
at com.ccadllc.cedi.dtrace.TraceSystem$Timer$RealTime.copy(TraceSystem.scala:145)
at com.ccadllc.cedi.dtrace.TraceSystem$Timer$RealTime.translate(TraceSystem.scala:148)
at com.ccadllc.cedi.dtrace.package$.translate(dtrace.scala:257)
at com.ccadllc.cedi.dtrace.TraceTNonEmptyParallelInstance$NonEmptyParallelTraceT$$anon$10.$anonfun$apply$2(TraceT.scala:803)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$map$2(TraceT.scala:732)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$ap$1(TraceT.scala:736)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$map$2(TraceT.scala:732)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$ap$1(TraceT.scala:736)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$map$2(TraceT.scala:732)
at com.ccadllc.cedi.dtrace.TraceTParallelInstance$ParallelTraceT$$anon$5.$anonfun$ap$1(TraceT.scala:736)
^ these last two lines keep repeataing
Looks strange considering that toIO
just appends one span to the whole computation and never emits it (as we're using NoOp emitter)
Also, works fine with traverse
on scales like tens of millions without any issues and the same works fine with just IO
both for traverse
or parTraverse
Not sure if there's implementation detail one should be aware of or there's a bug, but would appreciate any help 😅
Currently dtrace doesn’t provide the means to populate response headers with trace info which can be helpful to those who cache responses
The duration for logstash is microseconds for overview and nanos for duration field, regardless of timer and for general logging module it is microseconds throughout. It should respect timer resolution.
Looks like LoggingFactory
should be in com/ccadllc/cedi/dtrace/logging
. Fix in #59.
root[ERROR] java.lang.NoClassDefFoundError: com/ccadllc/cedi/dtrace/LoggingFactory$
root[ERROR] at com.ccadllc.cedi.dtrace.logging.LoggingConfig$.$anonfun$initialize$1(LoggingConfig.scala:33)
root[ERROR] at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
root[ERROR] at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:87)
root[ERROR] at cats.effect.internals.IORunLoop$.start(IORunLoop.scala:34)
root[ERROR] at cats.effect.internals.IOBracket$.$anonfun$apply$1(IOBracket.scala:44)
root[ERROR] at cats.effect.internals.IOBracket$.$anonfun$apply$1$adapted(IOBracket.scala:34)
root[ERROR] at cats.effect.internals.IORunLoop$RestartCallback.start(IORunLoop.scala:337)
root[ERROR] at cats.effect.internals.IORunLoop$.cats$effect$internals$IORunLoop$$loop(IORunLoop.scala:119)
root[ERROR] at cats.effect.internals.IORunLoop$RestartCallback.signal(IORunLoop.scala:351)
root[ERROR] at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:372)
root[ERROR] at cats.effect.internals.IORunLoop$RestartCallback.apply(IORunLoop.scala:312)
root[ERROR] at cats.effect.internals.IOShift$Tick.run(IOShift.scala:36)
root[ERROR] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
root[ERROR] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
root[ERROR] at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
root[ERROR] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
root[ERROR] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
root[ERROR] Caused by: java.lang.ClassNotFoundException: com.ccadllc.cedi.dtrace.LoggingFactory$
root[ERROR] at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
root[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
root[ERROR] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
root[ERROR] at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
root[ERROR] ... 17 more
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.