Skip to content

Commit ba34a9e

Browse files
committed
update opentelemetry extension docs
1 parent b4b7877 commit ba34a9e

File tree

1 file changed

+21
-10
lines changed

1 file changed

+21
-10
lines changed

doc/features/opentelemetry/README.md

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ Add the package `Cassandra.OpenTelemetry` to the project and add the extension m
99
```csharp
1010
var cluster = Cluster.Builder()
1111
.AddContactPoint(Program.ContactPoint)
12-
.WithSessionName(Program.SessionName)
1312
.WithOpenTelemetryInstrumentation()
1413
.Build();
1514
```
@@ -29,11 +28,13 @@ The table below displays the list of included attributes in this feature:
2928
| Attribute | Description | Output Values|
3029
|---|---|---|
3130
| db.namespace | The keyspace name. | *keyspace in use* |
32-
| db.operation.name | The type name of the operation being executed. | *Session Request* for session level calls and *Node Request* for node level calls |
33-
| db.query.text | The database statement being executed. Included as [optional configuration](#include-statement-as-an-attribute). | *database statement in use* |
34-
| db.system | An identifier for the database management system (DBMS) product being used. | cassandra |
35-
| server.address | The host node. | e.g.: 127.0.0.1 |
36-
| server.port | Port number. | e.g.: 9042 |
31+
| db.operation.name | The type name of the operation being executed. | `Session_Request({RequestType})` for session level calls and `Node_Request({RequestType})` for node level calls |
32+
| db.query.text | The database statement being executed. Included as [optional configuration](#include-statement-as-an-attribute). | e.g.: `SELECT * FROM system.local` |
33+
| db.system | An identifier for the database management system (DBMS) product being used. | `cassandra` |
34+
| server.address | The host node. | e.g.: `127.0.0.1` |
35+
| server.port | Port number. | e.g.: `9042` |
36+
37+
Note that in some cases the driver does not know which keyspace a request is targeting because the driver doesn't parse CQL query strings.
3738

3839
The console log below displays an example of a full Cassandra activity:
3940

@@ -43,15 +44,15 @@ Activity.SpanId: bd42cfc78b552cd1
4344
Activity.TraceFlags: Recorded
4445
Activity.ActivitySourceName: Cassandra.OpenTelemetry
4546
Activity.ActivitySourceVersion: 1.0.0.0
46-
Activity.DisplayName: Session Request
47+
Activity.DisplayName: Session_Request(SimpleStatement) system
4748
Activity.Kind: Client
4849
Activity.StartTime: 2024-09-13T14:08:36.9762191Z
4950
Activity.Duration: 00:00:00.0416284
5051
Activity.Tags:
5152
db.system: cassandra
52-
db.operation.name: Session Request
53+
db.operation.name: Session_Request(SimpleStatement)
5354
db.namespace: system
54-
db.query.text: SELECT * FROM system.local
55+
db.query.text: SELECT * FROM local
5556
Resource associated with Activity:
5657
service.name: CassandraDemo
5758
service.version: 1.0.0
@@ -72,7 +73,17 @@ As mentioned above, the attribute `db.query.text` is not included by default in
7273
```csharp
7374
var cluster = Cluster.Builder()
7475
.AddContactPoint(Program.ContactPoint)
75-
.WithSessionName(Program.SessionName)
7676
.AddOpenTelemetryInstrumentation(options => options.IncludeDatabaseStatement = true)
7777
.Build();
78+
```
79+
80+
### Batch Statement size
81+
82+
By default, the `OpenTelemetry` extension only uses up to `5` child statements of a `BatchStatement` to generate the `db.query.text` tag. If you want to change this number, set the `CassandraInstrumentationOptions` property `BatchChildStatementLimit`:
83+
84+
```csharp
85+
var cluster = Cluster.Builder()
86+
.AddContactPoint(Program.ContactPoint)
87+
.AddOpenTelemetryInstrumentation(options => options.BatchChildStatementLimit = 10)
88+
.Build();
7889
```

0 commit comments

Comments
 (0)