Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Logging Integration with Sentry,io

Hi

Can anyone help with a challenge I have.  We are trying to integrate and stream errors captured by tLogCatcher to stream via tRESTClient to our account in sentry.io.

 

The job is running and it seems to be packaging the JSON on but nothing ever arrives in sentry and doesn't fail.  Do we need to install something within the job to support sentry or are we missing a trick somewhere.  Surely - we're not the first to have done this...

 

I'm added images to this post to help understand the setup.

Labels (4)
19 Replies
Anonymous
Not applicable
Author

I'm an idiot (but it is late here and that code may be useful to you in the future), there is a MUCH easier way of solving this. Just tick the "Follow redirects" option on the Advanced Settings of the tRESTClient.

Anonymous
Not applicable
Author

Hi 

Thanks for the pointers.  Seems like we're getting somewhere now.  Attached is a console output after putting your code in there.  It seems from one of the messages in the console that we are missing a 'Referer header' in the sentry call.

I'll have our developer who set up sentry check this out but thought I'd share this in case you can spot anything else.

 

Thanks for the help - really appreciated.


error.txt.zip
Anonymous
Not applicable
Author

Think we now have it talking to sentry.  Suspect there are now some authentication issues within sentry that need sorting so we're investigating.  I'll keep you posted as it will be good to wrap this one up so we have a sentry integration solution on the community....

 

If reviewing the text file you see something else then do let me know...


Anonymous
Not applicable
Author

It looks like your error was caused by the file your tFileOutputDelimited_1 component is writing to already existing. You will need to enable it to append or to overwrite.

 

if authentication is required, look at the "Use Authentication" tick box on the tRESTClient.

Anonymous
Not applicable
Author

yeah  - the delimited file error is forced to fire the error message to check it goes to sentry.  

 

We are looking at the authentication.  I tried using the authentication method but that still failed - its an issue at the sentry end it seems so my team are looking into that now...

 

Will come back when we have a solution...

 

Thanks

dave

Anonymous
Not applicable
Author

Hey @rhall

ok - we've made a bit more progress.  Think we're now close.  I have downloaded and installed the sentry jar and had this loaded up with a tLibraryLoad.  I then have a java class I need to install so I can then call that from the job but not sure how to load it into Talend.  See images attached for what I mean...

 

Once this is installed then we are led to believe we should be off and running.

 

Any ideas?


Screen Shot 2018-09-24 at 14.18.01.png
Screen Shot 2018-09-24 at 14.17.50.png
Screen Shot 2018-09-24 at 14.17.09.png
Anonymous
Not applicable
Author

I'm confused. If you were able to call the REST service from a PHP script, then I don't quite understand the need for the Sentry Jar to be added to the job. A web service can be called from ANY source so long as the message and call are formatted properly. It sounded like it was just a security issue from the last message. 

 

However, using Java class to make the call will also work with Talend. First of all you need to create a Routine. A Routine is essentially just a Java class. You should be able to take the code you have shown me and add it to a Routine. Having said that, the code I have seen looks very basic and may need some tweaking to make it suit your requirements. For example, it has a "static void main" method which implies it is intended to be run from the command-line. If you have any Java guys there, ask them to tweak it so that you can call a "send" method as a static method. The send method will need to have at least a String parameter to hold your JSON.

 

Once you have your routine, you will need to add your Jar to its list of libraries. To do this, right click on the routine and select "Edit Routine Libraries". Add it here. This will mean you do not need the tLibraryLoad in your job.

 

The you can use your "send" method anywhere in your job. If you routine is called "MyRoutine" and your send method is called "send", you can call it using code like this.....

routines.MyRoutine.send(row1.errorJSON)

 

Anonymous
Not applicable
Author

Hi 

 

Thanks, you've been really helpful!

Our Java fella's have now sorted it.  None of us can understand why the API wasn't working when we could run via PHP but that became too much to sort when we could simply install the libraries and change the Java to send to sentry.  Must be something funny with Sentry...

 

After loading the 4 JARs via the tLibraryLoad component:

  • jackson-core-2.9.7.jar
  • sentry-1.7.5.jar
  • javax.servlet-api-3.0.1.jar
  • slf4j-api-1.8.0-beta2.jar

...and creating a class to call in a Code repository we were then able to call from the tJavaRow and we started to receive the messages in Sentry.

 

So, all good now and thanks again for your help...

Anonymous
Not applicable
Author

Glad you got it sorted. These struggles with Talend tend to benefit you in the long run as you usually end up learning something new about the tool while experimenting 🙂

 

It sounds like you have added your code to a Routine, which is great. If this is the case, try adding your libraries to the Routine (as I described in my last post) as this will remove the requirement for the tLibraryLoad components in your job. It will also mean that your code will work in ANY job without having to add the tLibraryLoad components. 

Anonymous
Not applicable
Author

Oh great - love that idea.  Thanks - will make sure I give that a go.  Missed that in the last post.

 

Thanks

Dave