Comments (10)
And this sample is using Phobos 2. Cool, I will check it out
from phobos-issues.
Hi @object,
Can you give us your Phobos configuration?
In the meantime, can you add Activity.Current = activity;
right after you created it and see if that works?
You might also want to do an assertion that the activity isn't null, StartActivity
can return null if the ActivitySource
does not have any listener or if the ActivityListener.Sample
isn't set
from phobos-issues.
@Arkatufus out Phobos configuration is quite simple, this is F# code:
let createSetup (sp: IServiceProvider) enableMetrics enableTracing =
let metrics = sp.GetRequiredService<IMetricsRoot>()
let tracer = sp.GetRequiredService<OpenTracing.ITracer>()
let builder = Phobos.Actor.Configuration.PhobosConfigBuilder()
let builder =
if enableMetrics then
builder.WithMetrics(fun b -> b.SetMetricsRoot(metrics) |> ignore)
else
builder
let builder =
if enableTracing then
builder.WithTracing (fun b -> b.SetTracer(tracer) |> ignore)
else
builder
PhobosSetup.Create(builder)
The activity is not null because I can see it included in a distributed trace from a transaction originated by another system (that sends a RabbitMQ message to us).
from phobos-issues.
And setting Activity.Current = activity didn't help.
from phobos-issues.
This is with the OpenTracing shim inside OpenTelemetry? How do you subscribe to that from the POV of the OTEL Sdk?
from phobos-issues.
Here's essentials of the bootstrapper code:
module PhobosBootstrapper =
let private createMetrics (mb: IMetricsBuilder) =
mb.Configuration.Configure (fun opts ->
opts.GlobalTags.Add("host", Dns.GetHostName())
opts.DefaultContextLabel <- "akka.net"
opts.Enabled <- true
opts.ReportingEnabled <- true)
let createSetup (sp: IServiceProvider) =
let metrics = sp.GetRequiredService<IMetricsRoot>()
let tracer = sp.GetRequiredService<OpenTracing.ITracer>()
let builder = Phobos.Actor.Configuration.PhobosConfigBuilder()
let builder = builder.WithTracing (fun b -> b.SetTracer(tracer) |> ignore)
PhobosSetup.Create(builder)
[<AutoOpen>]
module BootstrapperExtensions =
let assemblyName = Reflection.Assembly.GetEntryAssembly().GetName().Name
let buildTraceProvider (builder: TracerProviderBuilder) =
builder
.AddSource(assemblyName)
.SetResourceBuilder(
ResourceBuilder
.CreateDefault()
.AddService(assemblyName)
)
.AddAzureMonitorTraceExporter(fun o ->
o.ConnectionString <-
"InstrumentationKey="MY_KEY";IngestionEndpoint=https://westeurope-2.in.applicationinsights.azure.com/")
.Build()
type IServiceCollection with
member services.ConfigureTracing() : IServiceCollection =
services.AddOpenTelemetryTracing(fun builder -> buildTraceProvider (Sdk.CreateTracerProviderBuilder()) |> ignore)
|> ignore
services.AddSingleton<ITracer> (fun sp ->
let traceProvider = sp.GetRequiredService<TracerProvider>()
let tracer = new TracerShim(traceProvider.GetTracer(assemblyName), Propagators.DefaultTextMapPropagator)
GlobalTracer.RegisterIfAbsent(tracer) |> ignore
tracer :> ITracer)
module Bootstrapper =
let createActorSystem oddjobConfig serviceProvider enablePhobos =
let actorSystemSetup =
if oddjobConfig.Features.EnablePhobosInstrumentation && enablePhobos then
let bootstrapSetup = loadAkkaClusterConfigurationWithPhobos () |> BootstrapSetup.Create().WithConfig
(PhobosBootstrapper.createSetup serviceProvider oddjobConfig.Features.EnableAppMetrics oddjobConfig.Features.EnableOpenTracing)
.And(bootstrapSetup)
else
let bootstrapSetup = loadAkkaClusterConfiguration () |> BootstrapSetup.Create().WithConfig
Akka.Actor.Setup.ActorSystemSetup.Create bootstrapSetup
ActorSystem.Create(OddjobSystem, actorSystemSetup)
from phobos-issues.
BTW, I started playing with Phobos 2.0 Do you have any source code examples? All repos that I find at aaronontheweb refer to Phobos 1.x.
from phobos-issues.
Thanks @object - I will take a look at that.
Best sample I have right now is the otel
branch of our quickstart: https://github.com/petabridge/Petabridge.Phobos.Web/tree/otel
We're going to get Phobos 2.0 docs up soon though, so this shouldn't be as hard to find.
from phobos-issues.
Built small apps using Phobos 2.0. I can confirm that I distributed traces are propagated all the way, and after RabbitMQ messages are consumed its propagation context is used by Phobos actors.
I will continue testing this with a bigger app, but so far it looks good. If it works fine in Phobos 2.0, there is probably no need for you to spend time on investigating this issue for Phobos 1.x.
from phobos-issues.
Ok, thanks @object - I'll mark this as closed for now.
from phobos-issues.
Related Issues (20)
- Lots of noise in logging when using cluster sharding HOT 6
- Span is created for akka.actor.ask even when create-trace-upon-receive is set to off HOT 5
- UsableContext value becomes NULL in the middle of processing chain HOT 2
- Stashing message may result in reset UsableContext HOT 16
- Create a gauge for all alive actors of each type in any given `ActorSystem` HOT 1
- How to filter `Ask<T>` out of traces? HOT 6
- Manually created trace spans don't seem to flow across the cluster HOT 14
- When spans are created manually messages from cluster singleton break trace transactions HOT 19
- Does sending a message to sender from Persist/PersistAsync break trace transaction? HOT 10
- Can auto-generated shard messages be omitted from a trace transaction with manual span management? HOT 18
- Need to make all Akka.Cluster.Sharding infrastructure transparent in traces HOT 12
- Missing `unit` for all metrics received from Phobos in Prometheus HOT 16
- `Tracer.CurrentSpan` and `PhobosActorContext.ActiveSpan` should be the same when actor is processing message, but currently are not
- Add support for tracking Akka.Cluster.Sharding `ShardRegion` metrics HOT 1
- Phobos `DeadLetter` logging HOT 1
- `Ask<T>` tracing does not properly follow `Tracer.ActiveSpan` HOT 1
- Bug: System.InvalidOperationException: ValueFactory attempted to access the Value property of this instance.
- Link to Release notes from Nuget package? HOT 3
- Error "Cannot find serializer with id [210] (manifest [WTRACE])" when remoting from an F# script HOT 5
- How to handle messages between actor system where one of them uses Phobos tracing? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from phobos-issues.