Codota Logo
Db
Code IndexAdd Codota to your IDE (free)

How to use
Db
in
co.elastic.apm.agent.impl.transaction

Best Java code snippets using co.elastic.apm.agent.impl.transaction.Db (Showing top 6 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
ArrayList a =
  • Codota Iconnew ArrayList<String>()
  • Codota Iconnew ArrayList()
  • Codota Iconnew ArrayList<Object>()
  • Smart code suggestions by Codota
}
origin: elastic/apm-agent-java

private void serializeDbContext(final Db db) {
  writeFieldName("db");
  jw.writeByte(OBJECT_START);
  writeField("instance", db.getInstance());
  if (db.getStatement() != null) {
    writeLongStringField("statement", db.getStatement());
  } else {
    final CharBuffer statementBuffer = db.getStatementBuffer();
    if (statementBuffer != null && statementBuffer.length() > 0) {
      writeFieldName("statement");
      jw.writeString(statementBuffer);
      jw.writeByte(COMMA);
    }
  }
  writeField("type", db.getType());
  writeLastField("user", db.getUser());
  jw.writeByte(OBJECT_END);
}
origin: elastic/apm-agent-java

  public boolean hasContent() {
    return super.hasContent() || db.hasContent() || http.hasContent();
  }
}
origin: elastic/apm-agent-java

@Override
public void resetState() {
  super.resetState();
  db.resetState();
  http.resetState();
}
origin: elastic/apm-agent-java

  @Test
  void resetState() {
    Span span = new Span(mock(ElasticApmTracer.class))
      .withName("SELECT FROM product_types")
      .withType("db")
      .withSubtype("postgresql")
      .withAction("query");
    span.getContext().getDb()
      .withInstance("customers")
      .withStatement("SELECT * FROM product_types WHERE user_id=?")
      .withType("sql")
      .withUser("readonly_user");
    span.resetState();
    assertThat(span.getContext().hasContent()).isFalse();
    assertThat((CharSequence) span.getName()).isNullOrEmpty();
    assertThat(span.getType()).isNull();
    assertThat(span.getSubtype()).isNull();
    assertThat(span.getAction()).isNull();
  }
}
origin: elastic/apm-agent-java

  .withAction("query");
span.getContext().getDb()
  .withInstance("customers")
  .withStatement("SELECT * FROM product_types WHERE user_id=?")
  .withType("sql")
  .withUser("readonly_user");
span.addTag("monitored_by", "ACME");
span.addTag("framework", "some-framework");
origin: elastic/apm-agent-java

private void serializeSpanContext(SpanContext context) {
  writeFieldName("context");
  jw.writeByte(OBJECT_START);
  boolean spanContextWritten = false;
  Db db = context.getDb();
  if (db.hasContent()) {
    serializeDbContext(db);
    spanContextWritten = true;
  }
  Http http = context.getHttp();
  if (http.hasContent()) {
    if (spanContextWritten) {
      jw.writeByte(COMMA);
    }
    serializeHttpContext(http);
    spanContextWritten = true;
  }
  Map<String, String> tags = context.getTags();
  if (!tags.isEmpty()) {
    if (spanContextWritten) {
      jw.writeByte(COMMA);
    }
    writeFieldName("tags");
    serializeTags(tags);
  }
  jw.writeByte(OBJECT_END);
  jw.writeByte(COMMA);
}
co.elastic.apm.agent.impl.transactionDb

Javadoc

An object containing contextual data for database spans

Most used methods

  • getInstance
    Database instance name
  • getStatement
    A database statement (e.g. query) for the given database type
  • getStatementBuffer
    Returns the associated pooled CharBuffer to record the DB statement. Note: returns null unless #with
  • getType
    Database type. For any SQL database, "sql". For others, the lower-case database category, e.g. "cass
  • getUser
    Username for accessing database
  • hasContent
  • resetState
  • withInstance
    Database instance name
  • withStatement
    A database statement (e.g. query) for the given database type
  • withType
    Database type. For any SQL database, "sql". For others, the lower-case database category, e.g. "cass
  • withUser
    Username for accessing database
  • withUser

Popular in Java

  • Making http requests using okhttp
  • setContentView (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
    Creates and executes a periodic action that becomes enabled first after the given initial delay, and
  • requestLocationUpdates (LocationManager)
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • Format (java.text)
    The base class for all formats. This is an abstract base class which specifies the protocol for clas
  • Deque (java.util)
    A linear collection that supports element insertion and removal at both ends. The name deque is shor
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now