Lightstep: Inaccurate UI for child span - go

Background
I have a java server that is making an RPC call to a go server. The java rpc client and go rpc server are instrumented with lightstep. Everything about the trace looks normal except for where in the lightstep UI, the go rpc server span is placed.
The java span has ts 1493929521325 which is right before the request is sent to the go server. The go rpc server has 2 timestamps: 1493929521326 is when it received the request and started the span, 1493929521336 is after it responded and finished the span.
Problem
I would expect the UI to have the go span horizontally to the immediate right of the java span. Instead, it is far to the right.
The only possible cause I can think of is an incompatibility between v0.10.1 which java code is using and v0.9.1 which go is using. Is this a possibility? Do you have any thoughts on a possible cause?
The go code is essentially:
import (
lightstep "github.com/lightstep/lightstep-tracer-go"
opentracing "github.com/opentracing/opentracing-go"
)
tracer := lightstep.NewTracer(lightstep.Options{
AccessToken: ls.AccessToken,
Collector: lightstep.Endpoint{ls.Host, ls.Port, true},
Tags: map[string]interface{}{lightstep.ComponentNameKey: component},
})
spanContext, err := tracer.Extract(opentracing.TextMap, opentracing.TextMapCarrier(req.GetLightstepData()))
span = tracer.StartSpan(
endpoint,
opentracing.ChildOf(spanContext))
}
// handle the request
span.Finish()

[Disclaimer: I work at LightStep]
Sorry you're having trouble getting Java and Go to play well together. I suspect this is caused by time-correction being enabled in Java but not being used in Go.
You can disable time correction in Java using the withClockSkewCorrection(boolean clockCorrection)
option to turn off clockCorrection when passing in options to the LightStep tracer
Here is the updated README and a link to the option code
If you contact us via the [Support] button in LightStep, we should be able to get you sorted out. Please send us a note so that we can confirm that this is solved for you.
We'll start monitoring SO more carefully so that we catch these things earlier.
Thanks and happy tracing!
Will

Related

Cypress tests failing in firefox in pages with polling requests

I have a following test in Cypress:
visit first page with the header A
click on the Go to B Page button
assert that the header of the page is now B
It works fine in Chrome, but failing in Firefox, as on the page B I have some background polling requests, and when cypress switches to another test and those requests get "canceled" away, I get either TypeError: NetworkError when attempting to fetch resource or AbortError: The operation was aborted
All the requests are using fetch api, by the way.
The possibility to mute those errors through the uncaught:exception event seems a bad idea, and so does the idea to do something on the page to cancel the polling, as it is not the thing under testing.
Maybe someone has encoutnered this problem too and got some non-hacky solution?
I had a similar issue with Cypress tests in Firefox and resorted to the slightly hacky solution of using an uncaught:exception handler as you mention. It is possible to filter error messages somewhat at least:
function handleUncaughtException(err){
if (err.message.includes('Request aborted') ) {
console.log("Request aborted. Test will continue. Error:",err);
return false; // return false to make test continue
}
throw err;
}
cy.on('uncaught:exception',handleUncaughtException);
In principle you can cancel this handler when it's no longer needed. In my case though, this stopped the test working, presumably because the request started previous to or after the calls.
cy.removeListener("uncaught:exception", handleUncaughtException)
The Cypress docs have some advice on defining these: see at https://docs.cypress.io/api/events/catalog-of-events#Examples. It may be useful to put the handler in a support file, so that it is applied to all tests.
(See also https://docs.cypress.io/api/events/catalog-of-events#Event-Types and https://nodejs.org/api/events.html#events_emitter_removelistener_eventname_listener).

Are there any config NOT to use trace on specific environment

Now I have a Golang Application deployed on GAE, with stackdriver trace.
About stackdriver Trace, to get custom span data, I did set up on my code, like
exporter, err := stackdriver.NewExporter(stackdriver.Options{
ProjectID: os.Getenv("GOOGLE_CLOUD_PROJECT"),
})
if err != nil {
log.Fatal(err)
}
trace.RegisterExporter(exporter)
client := &http.Client{
Transport: &ochttp.Transport{
// Use Google Cloud propagation format.
Propagation: &propagation.HTTPFormat{},
},
}
ref. https://cloud.google.com/trace/docs/setup/go
On GAE, I succeed in viewing trace on my GCP console.
but, I DON'T want to trace these log on my local developing environment (I'm using docker).currently, I try to run my application on docker, nil pointer panic shows up on Span.Export() which may be called from Span.End().
So, I wonder if someone knows the way to DISABLE stackdriver trace on specific environment (with my case, on docker).
Otherwise, should I check condition of trace configuration, like as below ?
if trace.projectId != "" {
ctx := reque.Context()
_, span := trace.StartSpan(ctx,"Span blahblah")
defer span.End()
}
There is no point for Google in adding an extra logic like you need into the Trace code, the GAE apps are instrumented with, in order to disable that Trace code when the GAE App is executed somewhere in a third party environment like Docker on-prem. Most likely an answer to the question is "No, there is no magic config for that". Hence it is up-to-you how to sort this out.
As a general idea: following up an approach with [NoopExporter] offered by Emile Pels and having admitted the fact we can't get rid of the Trace code with "magic config", if I developed my app in Python I'd considered using decorator as a wrapper to bring piece of intelligence into the Trace calls, or redefining them as mock functions. It seems Golang does not have direct analog of Python decorators but this functionality could be implemented somehow. This is being discussed in the Internet, for example here:
Go Decorator Function Pattern
Redefine function so that it references its own self

Actionscript 4: NetConnection.connect(...) does not fire a NetStatusEvent event

I downloaded the red5-recorder (http://www.red5-recorder.com/) , which fails to allow me to start recording. After debugging I found that the netconnection, needed to record to a media server, created does not fire a NetStatusEvent event, so essentially it fails silently. I have implemented the connection with the following minimal working example:
trace("make net connection");
nc = new NetConnection();
nc.client = { onBWDone: function():void{ trace("bandwidth check done.") } };
trace("add event listener");
nc.addEventListener(NetStatusEvent.NET_STATUS, function(event:NetStatusEvent) {
trace("handle");
});
trace("connect!");
nc.connect("rtmp://localshost/oflaDemo/test/");
trace("connect done");
The output of this piece of code is:
make net connection
add event listener
connect!
connect done
The actionscript api states that the connect-call always fires such an event:
http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/NetConnection.html#includeExamplesSummary
Moreover, the netconnection is not 'connected' (a state of the NetConnection object) 10 seconds after the call. I also took a look at this: NetConnect fails silently in Flash when called from SilverLight But the fix suggested by the author, swapping rtmp and http in the connection uri, do not work. Also, I tested the uri and in fact the exact same code sniplet in a personal project, where it did work. I just can not seem to find why connecting to a media server fails silently in the red5-recorder project.
The awkward part is that if I pass some random string as a conenction uri, still nothing happens (no event, no exception, no crash). Also not setting nc.client becore nc.connect(), which caused exceptions in my experience, did not cause exceptions.
Any suggestions are welcome.
You are setting the address to localshost instead localhost.
nc.connect("rtmp://localshost/oflaDemo/test/");
Correct address:
nc.connect("rtmp://localhost/oflaDemo/test/");

How do you write and debug server side actionscript?

what is the best way to write and debug Server Side Action Script on Flash Media Server?
I use Flash Builder for syntax highlighting, but that's all.
I want to debug, make breakpoints and step-trough server application code.
Any ideas?
EDIT1: I know about administration console for viewing trace messages, but that is not real debugging for me.
Although I don't know of an easy way to step through code, there are some cool things you can do.
Since objects in SSAS are dynamic, you can write a custom logging method that dumps variables recursively. I've found this very useful. If you print the method name and dump arguments with each call, this is as good as stepping through code.
Since SSAS is interpreted, you can write a custom admin console that processes eval statements. This is useful when doing live code, or debugging code in a certain state.
Here is a link to the Adobe developers guide:
http://www.adobe.com/livedocs/flashmediaserver/3.0/hpdocs/help.html?content=Book_Part_34_ss_asd_1.html
This includes the developers guide, language reference, some tutorials, etc... Everything you need to get started.
A hello world in server side ActionScript 3 looks like this:
application.onConnect = function( client ) {
client.serverHelloMsg = function( helloStr ) {
return "Hello, " + helloStr + "!";
}
application.acceptConnection( client );
}
AMS (/FMS):
Client.prototype.foo = function (){
return this;
}
Client:
netConn.call('foo', new Responder(_debug, _debug));
And breakpoint over:
function _debug(... rest):void{
}
Is as good as it gets:
we use the client to debug the server
we have to restart the server every time the main.asc file changes
we have to use rsync to upload the file to the remove machine if you can't get a local dev environment (which i couldn't - after a day of futile attempts and this post being 4 years old)
Seriously, it's load of fun, try it!

Debugging: IE6 + SSL + AJAX + post form = 404 error

The Setting:
The program in question tries to post form data via an AJAX call to a target procedure contained in the same package as the caller. This is done for a site that uses a secure connection (HTTPS). The technology used here is PLSQL and the DOJO JavaScript library. The development tool is basically a text editor.
Code Snippet:
> function testPost() {
>> dojo.xhrPost( {
url: ''dr_tm_w_0120.test_post'',
form: ''orgForm'',
load: testPostXHRCallback,
error: testPostXHRError
});
}
> function testPostXHRCallback(data,ioArgs) {
>> alert(''post callback'');
try{
dojo.byId("messageDiv").innerHTML = data;
}
catch(ex){
if(ex.name == "TypeError")
{
alert("A type error occurred.");
}
}
return data;
}
>
function testPostXHRError(data, ioArgs) {
>> alert(data);
alert(''Error when retrieving data from the server!'');
return data;
}
The Problem:
When using IE6 (which the entire user-base uses), the response sent back from the server is a 404 error.
Observations:
The program works fine in Firefox.
The calling procedure cannot target any procedures within the same package.
The calling procedure can target outside sites (both http, https).
The other AJAX calls in the package that are not posts of form data work fine.
I've searched the internets and consulted with senior-skilled team members and haven't discovered anything that satisfactorily addresses the issue.
*Tried Q&A over at Dojo support forums.
The Questions:
What troubleshooting techniques do you recommend?
What troubleshooting tools do you recommend for HTTPS analyzing?
Any hypotheses on what the issue might be?
Any ideas for workarounds that aren't total (bad) hacks?
Ed. The Solution
lomaxx, thx for the fiddler tip. you have no idea how awesome it was to get that and use it as a debugging tool. after starting it up this is what i found and how i fixed it (at least in the short term):
> ef Fri, 8 Aug 2008 14:01:26 GMT dr_tm_w_0120.test_post: SIGNATURE (parameter names) MISMATCH VARIABLES IN FORM NOT IN PROCEDURE: SO1_DISPLAYED_,PO1_DISPLAYED_,RWA2_DISPLAYED_,DD1_DISPLAYED_ NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: 0
After seeing that message from the server, I kicked around Fiddler a bit more to see what else I could learn from it. Found that there's a WebForms tab that shows the values in the web form. Wouldn't you know it, the "xxx_DISPLAYED_" fields above were in it.
I don't really understand yet why these fields exist, because I didn't create them explicitly in the web PLSQL code. But I do understand now that the target procedure has to include them as parameters to work correctly. Again, this is only in the case of IE6 for me, as Firefox worked fine.
Well, that the short term answer and hack to fix it. Hopefully, a little more work in this area will lead to a better understanding of the fundamentals going on here.
First port of call would be to fire up Fiddler and analyze the data going to and from the browser.
Take a look at the headers, the url actually being called and the params (if any) being passed to the AJAX method and see if it all looks good before getting to the server.
If that all looks ok, is there any way you can verify it's actually hitting the server via logging, or tracing in the AJAX method?
ed: another thing I would try is rig up a test page to call the AJAX method on the server using a non-ajax based call and analyze the traffic in fiddler and compare the two.

Resources