-
Notifications
You must be signed in to change notification settings - Fork 879
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: Trask Stalnaker <[email protected]>
- Loading branch information
Showing
8 changed files
with
183 additions
and
12 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.../opentelemetry/javaagent/instrumentation/cassandra/v3_0/CassandraAttributesExtractor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* | ||
* Copyright The OpenTelemetry Authors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package io.opentelemetry.javaagent.instrumentation.cassandra.v3_0; | ||
|
||
import com.datastax.driver.core.ExecutionInfo; | ||
import io.opentelemetry.api.common.AttributesBuilder; | ||
import io.opentelemetry.context.Context; | ||
import io.opentelemetry.instrumentation.api.instrumenter.AttributesExtractor; | ||
import io.opentelemetry.semconv.SemanticAttributes; | ||
import javax.annotation.Nullable; | ||
|
||
public class CassandraAttributesExtractor | ||
implements AttributesExtractor<CassandraRequest, ExecutionInfo> { | ||
@Override | ||
public void onStart(AttributesBuilder attributes, Context context, CassandraRequest request) {} | ||
|
||
@Override | ||
public void onEnd( | ||
AttributesBuilder attributes, | ||
Context context, | ||
CassandraRequest request, | ||
@Nullable ExecutionInfo executionInfo, | ||
@Nullable Throwable error) { | ||
if (executionInfo == null) { | ||
return; | ||
} | ||
attributes.put( | ||
SemanticAttributes.SERVER_ADDRESS, | ||
executionInfo.getQueriedHost().getSocketAddress().getHostString()); | ||
attributes.put( | ||
SemanticAttributes.SERVER_PORT, | ||
executionInfo.getQueriedHost().getSocketAddress().getPort()); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters