Skip to content

Commit e08709a

Browse files
committed
cassandra telemetry
1 parent abb4920 commit e08709a

File tree

11 files changed

+218
-17
lines changed

11 files changed

+218
-17
lines changed

docs/instrumentation-list.yaml

Lines changed: 199 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,8 @@ libraries:
16591659
- org.apache.camel:camel-core:[2.19,3)
16601660
configurations:
16611661
- name: otel.instrumentation.camel.experimental-span-attributes
1662-
description: Enable the capture of experimental span attributes.
1662+
description: |
1663+
Enable the capture of experimental `camel.uri`, `camel.kafka.partitionKey`, `camel.kafka.key` and `camel.kafka.offset` span attributes.
16631664
type: boolean
16641665
default: false
16651666
cassandra:
@@ -1677,6 +1678,55 @@ libraries:
16771678
description: Enables statement sanitization for database queries.
16781679
type: boolean
16791680
default: true
1681+
telemetry:
1682+
- when: default
1683+
spans:
1684+
- span_kind: CLIENT
1685+
attributes:
1686+
- name: db.cassandra.table
1687+
type: STRING
1688+
- name: db.name
1689+
type: STRING
1690+
- name: db.operation
1691+
type: STRING
1692+
- name: db.statement
1693+
type: STRING
1694+
- name: db.system
1695+
type: STRING
1696+
- name: network.peer.address
1697+
type: STRING
1698+
- name: network.peer.port
1699+
type: LONG
1700+
- name: network.type
1701+
type: STRING
1702+
- name: server.address
1703+
type: STRING
1704+
- name: server.port
1705+
type: LONG
1706+
- when: otel.semconv-stability.opt-in=database
1707+
spans:
1708+
- span_kind: CLIENT
1709+
attributes:
1710+
- name: db.collection.name
1711+
type: STRING
1712+
- name: db.namespace
1713+
type: STRING
1714+
- name: db.operation.name
1715+
type: STRING
1716+
- name: db.query.text
1717+
type: STRING
1718+
- name: db.system.name
1719+
type: STRING
1720+
- name: network.peer.address
1721+
type: STRING
1722+
- name: network.peer.port
1723+
type: LONG
1724+
- name: network.type
1725+
type: STRING
1726+
- name: server.address
1727+
type: STRING
1728+
- name: server.port
1729+
type: LONG
16801730
- name: cassandra-4.0
16811731
description: |
16821732
Instruments the Cassandra database client, providing database client spans and metrics for Cassandra queries.
@@ -1691,6 +1741,79 @@ libraries:
16911741
description: Enables statement sanitization for database queries.
16921742
type: boolean
16931743
default: true
1744+
telemetry:
1745+
- when: default
1746+
spans:
1747+
- span_kind: CLIENT
1748+
attributes:
1749+
- name: db.cassandra.consistency_level
1750+
type: STRING
1751+
- name: db.cassandra.coordinator.dc
1752+
type: STRING
1753+
- name: db.cassandra.coordinator.id
1754+
type: STRING
1755+
- name: db.cassandra.idempotence
1756+
type: BOOLEAN
1757+
- name: db.cassandra.page_size
1758+
type: LONG
1759+
- name: db.cassandra.speculative_execution_count
1760+
type: LONG
1761+
- name: db.cassandra.table
1762+
type: STRING
1763+
- name: db.name
1764+
type: STRING
1765+
- name: db.operation
1766+
type: STRING
1767+
- name: db.statement
1768+
type: STRING
1769+
- name: db.system
1770+
type: STRING
1771+
- name: network.peer.address
1772+
type: STRING
1773+
- name: network.peer.port
1774+
type: LONG
1775+
- name: network.type
1776+
type: STRING
1777+
- name: server.address
1778+
type: STRING
1779+
- name: server.port
1780+
type: LONG
1781+
- when: otel.semconv-stability.opt-in=database
1782+
spans:
1783+
- span_kind: CLIENT
1784+
attributes:
1785+
- name: cassandra.consistency.level
1786+
type: STRING
1787+
- name: cassandra.coordinator.dc
1788+
type: STRING
1789+
- name: cassandra.coordinator.id
1790+
type: STRING
1791+
- name: cassandra.page.size
1792+
type: LONG
1793+
- name: cassandra.query.idempotent
1794+
type: BOOLEAN
1795+
- name: cassandra.speculative_execution.count
1796+
type: LONG
1797+
- name: db.collection.name
1798+
type: STRING
1799+
- name: db.namespace
1800+
type: STRING
1801+
- name: db.operation.name
1802+
type: STRING
1803+
- name: db.query.text
1804+
type: STRING
1805+
- name: db.system.name
1806+
type: STRING
1807+
- name: network.peer.address
1808+
type: STRING
1809+
- name: network.peer.port
1810+
type: LONG
1811+
- name: network.type
1812+
type: STRING
1813+
- name: server.address
1814+
type: STRING
1815+
- name: server.port
1816+
type: LONG
16941817
- name: cassandra-4.4
16951818
description: |
16961819
Instruments the Cassandra database client, providing database client spans and metrics for Cassandra queries.
@@ -1707,6 +1830,79 @@ libraries:
17071830
description: Enables statement sanitization for database queries.
17081831
type: boolean
17091832
default: true
1833+
telemetry:
1834+
- when: default
1835+
spans:
1836+
- span_kind: CLIENT
1837+
attributes:
1838+
- name: db.cassandra.consistency_level
1839+
type: STRING
1840+
- name: db.cassandra.coordinator.dc
1841+
type: STRING
1842+
- name: db.cassandra.coordinator.id
1843+
type: STRING
1844+
- name: db.cassandra.idempotence
1845+
type: BOOLEAN
1846+
- name: db.cassandra.page_size
1847+
type: LONG
1848+
- name: db.cassandra.speculative_execution_count
1849+
type: LONG
1850+
- name: db.cassandra.table
1851+
type: STRING
1852+
- name: db.name
1853+
type: STRING
1854+
- name: db.operation
1855+
type: STRING
1856+
- name: db.statement
1857+
type: STRING
1858+
- name: db.system
1859+
type: STRING
1860+
- name: network.peer.address
1861+
type: STRING
1862+
- name: network.peer.port
1863+
type: LONG
1864+
- name: network.type
1865+
type: STRING
1866+
- name: server.address
1867+
type: STRING
1868+
- name: server.port
1869+
type: LONG
1870+
- when: otel.semconv-stability.opt-in=database
1871+
spans:
1872+
- span_kind: CLIENT
1873+
attributes:
1874+
- name: cassandra.consistency.level
1875+
type: STRING
1876+
- name: cassandra.coordinator.dc
1877+
type: STRING
1878+
- name: cassandra.coordinator.id
1879+
type: STRING
1880+
- name: cassandra.page.size
1881+
type: LONG
1882+
- name: cassandra.query.idempotent
1883+
type: BOOLEAN
1884+
- name: cassandra.speculative_execution.count
1885+
type: LONG
1886+
- name: db.collection.name
1887+
type: STRING
1888+
- name: db.namespace
1889+
type: STRING
1890+
- name: db.operation.name
1891+
type: STRING
1892+
- name: db.query.text
1893+
type: STRING
1894+
- name: db.system.name
1895+
type: STRING
1896+
- name: network.peer.address
1897+
type: STRING
1898+
- name: network.peer.port
1899+
type: LONG
1900+
- name: network.type
1901+
type: STRING
1902+
- name: server.address
1903+
type: STRING
1904+
- name: server.port
1905+
type: LONG
17101906
clickhouse:
17111907
- name: clickhouse-client-0.5
17121908
description: Instruments the V1 ClickHouseClient, providing database client spans
@@ -1785,8 +1981,8 @@ libraries:
17851981
- com.couchbase.client:java-client:[2,3)
17861982
configurations:
17871983
- name: otel.instrumentation.couchbase.experimental-span-attributes
1788-
description: Enables experimental span attributes couchbase.operation_id and
1789-
couchbase.local.address
1984+
description: Enables experimental span attributes `couchbase.operation_id` and
1985+
`couchbase.local.address`
17901986
type: boolean
17911987
default: false
17921988
- name: couchbase-2.6

instrumentation-docs/instrumentations.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ readonly INSTRUMENTATIONS=(
116116
"openai:openai-java-1.1:javaagent:test"
117117
"aws-lambda:aws-lambda-core-1.0:javaagent:test"
118118
"aws-lambda:aws-lambda-events-2.2:javaagent:test"
119-
"azure-core:azure-core-1.19:javaagent:testAzure"
119+
"cassandra:cassandra-3.0:javaagent:test"
120+
"cassandra:cassandra-3.0:javaagent:testStableSemconv"
121+
"cassandra:cassandra-4.0:javaagent:test"
122+
"cassandra:cassandra-4.0:javaagent:testStableSemconv"
123+
"cassandra:cassandra-4.4:javaagent:test"
124+
"cassandra:cassandra-4.4:javaagent:testStableSemconv"
120125
)
121126

122127
# Some instrumentation test suites don't run ARM, so we use colima to run them in an x86_64

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/InstrumentationAnalyzer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private void enrichModule(InstrumentationModule module) throws IOException {
6464
}
6565

6666
module.setTargetVersions(getVersionInformation(module));
67-
module.setMetrics(MetricParser.get(module, fileManager));
67+
module.setMetrics(MetricParser.getMetrics(module, fileManager));
6868
module.setSpans(SpanParser.getSpans(module, fileManager));
6969
}
7070

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/EmittedParser.java

Lines changed: 0 additions & 8 deletions
This file was deleted.

instrumentation-docs/src/main/java/io/opentelemetry/instrumentation/docs/parsers/MetricParser.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ public class MetricParser extends TelemetryParser {
2929
* @param fileManager the file manager to use for file operations
3030
* @return a map where the key is the 'when' condition and the value is a list of metrics
3131
*/
32-
public static Map<String, List<EmittedMetrics.Metric>> get(
32+
public static Map<String, List<EmittedMetrics.Metric>> getMetrics(
3333
InstrumentationModule module, FileManager fileManager) {
3434
Map<String, EmittedMetrics> metrics =
3535
EmittedMetricsParser.getMetricsFromFiles(fileManager.rootDir(), module.getSrcPath());

instrumentation-docs/src/test/java/io/opentelemetry/instrumentation/docs/parsers/SpanParserTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ void getSpansFromFilesIncludesAllowListedScopes(@TempDir Path tempDir) throws IO
248248

249249
EmittedSpans emittedSpans = fileContents.get("default");
250250

251-
// Aggregate spans - only target scope should be included
251+
// use armeria scope that doesn't match the scope in the file
252252
Map<String, Map<String, Set<TelemetryAttribute>>> spans =
253253
SpanParser.SpanAggregator.aggregateSpans(
254254
"default", emittedSpans, "io.opentelemetry.armeria-grpc-1.14");

instrumentation/camel-2.20/metadata.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ description: >
44
'camel-opentelemetry' component provided directly by the Camel project.
55
configurations:
66
- name: otel.instrumentation.camel.experimental-span-attributes
7-
description: Enable the capture of experimental span attributes.
7+
description: >
8+
Enable the capture of experimental `camel.uri`, `camel.kafka.partitionKey`, `camel.kafka.key`
9+
and `camel.kafka.offset` span attributes.
810
type: boolean
911
default: false

instrumentation/cassandra/cassandra-3.0/javaagent/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ configurations.testRuntimeClasspath.get().resolutionStrategy.force("com.google.g
4343
tasks {
4444
withType<Test>().configureEach {
4545
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
46+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
4647
}
4748

4849
val testStableSemconv by registering(Test::class) {
4950
jvmArgs("-Dotel.semconv-stability.opt-in=database")
51+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
5052
}
5153

5254
check {

instrumentation/cassandra/cassandra-4.0/javaagent/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,12 @@ dependencies {
2626
tasks {
2727
withType<Test>().configureEach {
2828
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
29+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
2930
}
3031

3132
val testStableSemconv by registering(Test::class) {
3233
jvmArgs("-Dotel.semconv-stability.opt-in=database")
34+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
3335
}
3436

3537
check {

instrumentation/cassandra/cassandra-4.4/javaagent/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,12 @@ dependencies {
2929
tasks {
3030
withType<Test>().configureEach {
3131
usesService(gradle.sharedServices.registrations["testcontainersBuildService"].service)
32+
systemProperty("collectMetadata", findProperty("collectMetadata")?.toString() ?: "false")
3233
}
3334

3435
val testStableSemconv by registering(Test::class) {
3536
jvmArgs("-Dotel.semconv-stability.opt-in=database")
37+
systemProperty("metaDataConfig", "otel.semconv-stability.opt-in=database")
3638
}
3739

3840
check {

0 commit comments

Comments
 (0)