Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Jonas Kunz
    @JonasKunz
    You'll most likely need a JDBC driver specific rule for the driver you are using (HSQLDB in the demo)
    unknownuu
    @unknownuu
    Sure will check @JonasKunz . Thanks a lot. Don't we need to provide methods name in 'tracemaintestReportmethod' scope ?
    Jonas Kunz
    @JonasKunz
    If you don't provide any methods, all methods of the given class with be instrumented
    unknownuu
    @unknownuu

    Hi @JonasKunz , I tried to implemet JDBC tracing for MSSQL prepared statement by referring the HSQL db conf in demo app.
    getting below exception. Database name gettting printed in trace but not SQL queries.
    below is my instrumentation config

    inspectit:
      instrumentation:
        data:
          db_name: {down-propagation: NONE, is-tag: false}
          sql: {down-propagation: NONE, is-tag: false}
          servicegraph_is_entry: {down-propagation: NONE, is-tag: false}
        scopes:
          mssqldb_prepared_statement_execute:
            type:
              name: com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement
            methods:
              - name: execute
                matcher-mode: STARTS_WITH
        rules:
          mssql_get_prep_statement_sql:
            scopes:
              mssqldb_prepared_statement_execute: true
            tracing:
              attributes:
                database: db_name
                sql: sql
            entry:
              db_name:
                action: get_jdbc_statement_connection_name
              sql:
                action: mssql_prepared_statement_get_sql
         actions:
            mssql_prepared_statement_get_sql:
            imports:
              - com.microsoft.sqlserver.jdbc
              - java.lang.reflect
            input:
              _this: SQLServerPreparedStatement
              _class: Class
            value-body: |
              Field sqlField = _class.getDeclaredField("sql");
              sqlField.setAccessible(true);
              return sqlField.get(_this);
    
          get_jdbc_statement_connection_name:
            imports:
              - java.sql
            input:
              _this: Statement
            value-body: |
              if(!_this.isClosed()) {
                Connection con = _this.getConnection();
                String url = con.getMetaData().getURL();
    
                int semiColonIndex = url.indexOf(';');
                if(semiColonIndex != -1) {
                  url = url.substring(0,semiColonIndex);
                }
    
                int questionIndex = url.indexOf('?');
                if(questionIndex != -1) {
                  url = url.substring(0,questionIndex);

    When I execute with this configuration only DB name is getting logged in trace.
    Encountering below exception.

    2020-02-13 23:13:08,894 ERROR 81787820 --- [] [Bean#0_Worker-1] r.i.o.c.instrumentation.hook.MethodHook : Entry action Action 'mssql_prepared_statement_get_sql' for call 'sql' executed for method com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery threw an exception and from now on is disabled!
    java.lang.NoSuchFieldException: sql
    at java.lang.Class.getDeclaredField(Class.java:2070)
    at com.sun.proxy.inspectitGen

    KaTeX parse error: Can't use function '$' in math mode at position 1: $̲557729609728220…: $5577296097282200557.executeImpl(GenericActionTemplate.java)
            at com.sun.proxy.inspectitGen
    $5577296097282200557.execute(GenericActionTemplate.java:24)
    at rocks.inspectit.ocelot.core.instrumentation.actions.bound.NonVoidDynamicBoundGenericAction.execute(NonVoidDynamicBoundGenericAction.java:28)
    at rocks.inspectit.ocelot.core.instrumentation.hook.MethodHook.onEnter(MethodHook.java:61)
    at com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeQuery(SQLServerPreparedStatement.java:429)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
    at org.apache.commons.dbcp.DelegatingPreparedStatement.executeQuery(DelegatingPreparedStatement.java:96)
    at sun.reflect.GeneratedMethodAccessor904.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.bull.javamelody.JdbcWrapper.doExecute(JdbcWrapper.java:412)
    at net.bull.javamelody.JdbcWrapper$StatementInvocationHandler.invoke(JdbcWrapper.java:137)
    at net.bull.javamelody.JdbcWrapper$DelegatingInvocationHandler.invoke(JdbcWrapper.java:294)
    at com.sun.proxy.$Proxy498.executeQuery(Unknown Source)
    at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.extract(ResultSetReturnImpl.java:70)

    Can you please help me with this.! Thanks

    Jonas Kunz
    @JonasKunz
    The action mssql_prepared_statement_get_sql tries to lookup an sql private field of the given SQLServerPreparedStatement class. This field doesn't exist, therefore you get the NoSuchFieldException. Have a look at the source code:
    https://jar-download.com/artifacts/com.microsoft.sqlserver/mssql-jdbc/6.1.0.jre8/source-code/com/microsoft/sqlserver/jdbc/SQLServerPreparedStatement.java
    You instead need to use the field sqlCommand.
    Marius Oehler
    @mariusoe
    Hi,
    when we tried to instrument MSSQL the last time, we had to use the userSQL field instead sql because the other ones where not populated all the time. Maybe you can try this field aswell.
    unknownuu
    @unknownuu
    Thanks @JonasKunz , @mariusoe ... 'userSQL ' worked fines.!
    tgrperf
    @tgrperf
    Hello,
    tgrperf
    @tgrperf
    I implement JDBC tracing for Oracle prepared statement based on the hsql db conf in demo app.but no sql traces shown, only database trace is displayed.
    Here is my conf :
    inspectit:
    instrumentation:
    data:
      db_name: {down-propagation: NONE, is-tag: false}
      sql: {down-propagation: NONE, is-tag: false}
      servicegraph_is_entry: {down-propagation: NONE, is-tag: false}
    
    scopes:
      oracle_prepared_statement_execute:
        type:
          name: oracle.jdbc.OraclePreparedStatement
        methods:
          - name: execute
            matcher-mode: STARTS_WITH
    
    rules:
      # Extract the sql and add it to the trace
      oracle_get_prep_statement_sql:
        scopes:
          oracle_prepared_statement_execute: true
        tracing:
          attributes:
            database: db_name
            sql: sql
        entry:
          db_name:
            action: get_jdbc_statement_connection_name
          sql:
            action: oracle_prepared_statement_get_sql
    
      # We also trace JDBC calls including their target database
      servicegraph_record_jdbc_calls:
        tracing:
          start-span: true
          attributes:
            database: db_name
          start-span-conditions:
            only-if-true: servicegraph_is_entry
        entry:
          db_name:
            action: get_jdbc_statement_connection_name
    
    
    actions:

    Extracts the SQL from a PreparedStatement for ORACLEDB

      oracle_prepared_statement_get_sql:
        imports:
          - oracle.jdbc
          - java.lang.reflect
        input:
          _this: OraclePreparedStatement
          _class: Class
        value-body:
          Field sqlField = _class.getDeclaredField("sql");
          sqlField.setAccessible(true);
          return sqlField.get(_this);
    tgrperf
    @tgrperf
    no errors shown in log files.
    tgrperf
    @tgrperf
    image.png
    image.png
    Jonas Kunz
    @JonasKunz
    You should see an error in the logs because there is no "sql" Field for Oracle
    tgrperf
    @tgrperf
    Hello,
    oracle_prepared_statement_get_sql action was'nt triggered at all !! and my log files does'nt show any errors.so i add sql entry to servicegraph_record_jdbc_calls (sql:
    action: get_oracle_prepared_statement_sql
    and my
    tgrperf
    @tgrperf
    action is now triggered and i can see "sql" Field error in traces. after replacing sql field with originalSql one , sql queries are shown now in zipkin.
    Thanks a lot.
    tgrperf
    @tgrperf
    Hello, now i would like to show business services called through http servlets in zipkin.is there a way to link instrumented services/api to their http calling requests?
    Jonas Kunz
    @JonasKunz
    What do you mean by "show business services" ? You can (a) add attributes to your traces identifying your business transaction or (b) trace the methods identifying your business transaction
    tgrperf
    @tgrperf
    i mean (a) , add methods' name of business transactions processed in one http request.as for (b) , this is already done in my config files, and i can view all my business transactions with response time but in isolation from http requests.
    something like this :
    image.png
    so i wonder how can i add business & dao transactions to my http request tracing in zipkin.
    Jonas Kunz
    @JonasKunz
    You need to instrument the methods of your services, have a look at the following part of the documentation:
    https://inspectit.github.io/inspectit-ocelot/docs/instrumentation/scopes
    tgrperf
    @tgrperf
    I've defined scopes for my business & dao services/transactions, but to which predifined rule i have to attache my scopes? exemple for my oracle sql tracing i've used servicegraph_record_jdbc_calls , which rule to use for my need.
    Jonas Kunz
    @JonasKunz
    There currently is no rule (will soon change), so create one yourself:
    inspectit:
      instrumentation:
        rules:
          trace_service:
            scopes:
              your_scope: true 
            tracing:
              start-span: true
    tgrperf
    @tgrperf
    OK, it's working now with this config, thanks a lot.
    tgrperf
    @tgrperf
    Hello, i'm facing zipkin/elasticsearch disk space issues (high disk consumption), is there a way to limit spans less than 10s for example with inspectit configuration??
    Jonas Kunz
    @JonasKunz
    You have to options to reduce the number of traces:
    cattox
    @cattox
    Hi all, I'm trying to do something that I believe is quite simple, but I'm struggling to find the correct configuration for it. I've spent some time reading the documentation and searching the web with little success. I have my scenario working as I wanted except for a little detail. I want to consider only the spans that take more than 10ms to complete. Can you point me out the correct way to achieve it? Thanks in advance.
    cattox
    @cattox
    I know that the previous message talks about keeping only slow traces, but what I really want is to keep all traces only with slow spans.
    Jonas Kunz
    @JonasKunz

    Unfortunately, here the problem is the same: With OpenCensus / OpenTelemetry / OpenTracing, a span needs to know whether or not it shall be sampled at thepoint in time when it is started.

    Why is this necessary?
    When a span is started, it makes itself the parent of all following spans. Therefore it already needs to know at this point, if it should make itself the parent of following spans or not.

    RRadziejewski
    @RRadziejewski
    How to add some tracing config which can be assigned to every project so i can basically test if traces are working, Im on this from 2 days, please help
    @JonasKunz Can you please help ?
    Jonas Kunz
    @JonasKunz
    As stated in git, by using the configuration provided with the demo you should be able to see traces.
    Alternatively yo ucan wait until we release version 1.3 this week, which will include the tracing configuration in it's core. This means then no additional configuration except for the jaeger exporter is required to see HTTP traces.
    Jonas Kunz
    @JonasKunz
    *in github
    RRadziejewski
    @RRadziejewski
    When will be the release
    ?
    unknownuu
    @unknownuu
    How do we get method level CPU time in inspectIT-ocelot. I googled and found in inspectIT using 'java.lang.management.ThreadMXBean' we can capture 'getCurrentThreadCpuTime' . How do we do it in ocelot. any sample code would really help. do we need to add it in actions?
    Kevin Lotz
    @lotzk

    Hi, im trying to trace an application with ocelot. I need the FQN of each method being called and for this purpose I use the following action

    get_method_fqn:
            input:
              _methodName: String
              _class: Class
            value: "new StringBuilder(_class.getName()).append('.').append(_methodName).toString()"

    However, this does not seem to register constructor calls. Is there a way to trace object creation / constructor calls?

    Patrick-Eichhorn
    @Patrick-Eichhorn

    Hi Kevin, yes, this is possible, but this is not defined in the actions but under the scopes. There you can define if it is a constructor method: with the attribute "is-constructor: true" (see also https://inspectit.github.io/inspectit-ocelot/docs/instrumentation/scopes#method-matcher).

    What does the scope you defined look like?

    Kevin Lotz
    @lotzk

    Hi Patrick, thanks for replying. The scope I'm using looks like this:

      instrumentation:
        scopes:
          allClasses:
            type:
              name: net.ex
              matcher-mode: STARTS_WITH_IGNORE_CASE
    #        methods:
    #          - is-constructor: true

    This works fine als long as the last two lines are commented out. If I include them, no spans are received at all.

    Patrick-Eichhorn
    @Patrick-Eichhorn

    Hi Kevin,
    your configuration is correct, if the last two lines are commented out, this means that only constructors are instrumented. That no spans arrive may be because the constructors are not called. By the way, the constructors in your configuration are instrumented even if the last two lines are commented, because the scope is on all methods of the class.

    Alternatively, it is possible that the span is overlooked accidentally. For this I have a small example from the Petclinic-Demo*:

    Config.png
    Constructors are displayed as {ClassName}.<init> in the spans. For the petclinic example, which instruments the constructors of the class petDetails*, the span would look like in the following picture:
    Span.png