Skip to content

Commit ac4928b

Browse files
emreyalvackhushijain21dependabot[bot]songy23paulojmdias
authored
[exporter/cassandraexporter] upgrade cassandra library version (#43871)
<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue. Ex. Adding a feature - Explain what this achieves.--> #### Description Upgrade cassandra library version <!-- Issue number (e.g. #1234) or full URL to issue, if applicable. --> #### Link to tracking issue Fixes <!--Describe what testing was performed and which tests were added.--> #### Testing <!--Describe the documentation added.--> #### Documentation <!--Please delete paragraphs that you did not use before submitting.--> #### PR #43691 --------- Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: Paulo Dias <[email protected]> Signed-off-by: alex boten <[email protected]> Co-authored-by: Khushi Jain <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Yang Song <[email protected]> Co-authored-by: Paulo Dias <[email protected]> Co-authored-by: Alex Boten <[email protected]> Co-authored-by: Kaiyan White <[email protected]>
1 parent da6db67 commit ac4928b

File tree

7 files changed

+52
-27
lines changed

7 files changed

+52
-27
lines changed
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Use this changelog template to create an entry for release notes.
2+
3+
# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix'
4+
change_type: enhancement
5+
6+
# The name of the component, or a single word describing the area of concern, (e.g. receiver/filelog)
7+
component: exporter/cassandra
8+
9+
# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`).
10+
note: "`cassandraexporter`: Upgrade cassandra library version"
11+
12+
# Mandatory: One or more tracking issues related to the change. You can use the PR number here if no issue exists.
13+
issues: [43691]
14+
15+
# (Optional) One or more lines of additional information to render under the primary note.
16+
# These lines will be padded with 2 spaces and then inserted directly into the document.
17+
# Use pipe (|) for multiline entries.
18+
subtext: |
19+
Upgrade cassandra library version.
20+
21+
# If your change doesn't affect end users or the exported elements of any package,
22+
# you should instead start your pull request title with [chore] or use the "Skip Changelog" label.
23+
# Optional: The change log or logs in which this entry should be included.
24+
# e.g. '[user]' or '[user, api]'
25+
# Include 'user' if the change is relevant to end users.
26+
# Include 'api' if there is a change to a library API.
27+
# Default: '[user]'
28+
change_logs: [user]

exporter/cassandraexporter/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,14 +18,14 @@
1818
The following settings can be optionally configured:
1919

2020
- `dsn` The Cassandra server DSN (Data Source Name), for example `127.0.0.1`.
21-
reference: [https://pkg.go.dev/github.com/gocql/gocql](https://pkg.go.dev/github.com/gocql/gocql)
21+
reference: [github.com/apache/cassandra-gocql-driver/v2](https://github.com/apache/cassandra-gocql-driver/)
2222
- `port` (default = 9042): The Cassandra server port
2323
- `timeout` (default = 10s): The Cassandra server connection timeout
2424
- `keyspace` (default = otel): The keyspace name.
2525
- `trace_table` (default = otel_spans): The table name for traces.
2626
- `replication` (default = class: SimpleStrategy, replication_factor: 1): The strategy of
2727
replication. https://cassandra.apache.org/doc/4.1/cassandra/architecture/dynamo.html#replication-strategy
28-
- `compression` (default = LZ4Compressor): https://cassandra.apache.org/doc/latest/cassandra/operating/compression.html
28+
- `compression` (default = LZ4Compressor): https://cassandra.apache.org/doc/4.0/cassandra/operating/compression.html
2929
- `auth` (default = username: "", password: "") Authorization for the Cassandra.
3030

3131
## Example

exporter/cassandraexporter/exporter_logs.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"fmt"
1111
"time"
1212

13-
"github.com/gocql/gocql"
13+
gocql "github.com/apache/cassandra-gocql-driver/v2"
1414
"go.opentelemetry.io/collector/component"
1515
"go.opentelemetry.io/collector/pdata/plog"
1616
"go.uber.org/zap"
@@ -45,11 +45,11 @@ func initializeLogKernel(cfg *Config) error {
4545

4646
defer session.Close()
4747

48-
createDatabaseError := session.Query(parseCreateDatabaseSQL(cfg)).WithContext(ctx).Exec()
48+
createDatabaseError := session.Query(parseCreateDatabaseSQL(cfg)).ExecContext(ctx)
4949
if createDatabaseError != nil {
5050
return createDatabaseError
5151
}
52-
createLogTableError := session.Query(parseCreateLogTableSQL(cfg)).WithContext(ctx).Exec()
52+
createLogTableError := session.Query(parseCreateLogTableSQL(cfg)).ExecContext(ctx)
5353
if createLogTableError != nil {
5454
return createLogTableError
5555
}
@@ -135,7 +135,7 @@ func (e *logsExporter) pushLogsData(ctx context.Context, ld plog.Logs) error {
135135
string(bodyByte),
136136
resAttr,
137137
logAttr,
138-
).WithContext(ctx).Exec()
138+
).ExecContext(ctx)
139139

140140
if insertLogError != nil {
141141
e.logger.Error("insert log error", zap.Error(insertLogError))

exporter/cassandraexporter/exporter_logs_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"errors"
88
"testing"
99

10-
"github.com/gocql/gocql"
10+
gocql "github.com/apache/cassandra-gocql-driver/v2"
1111
"github.com/stretchr/testify/require"
1212
)
1313

exporter/cassandraexporter/exporter_traces.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"fmt"
99
"time"
1010

11-
"github.com/gocql/gocql"
11+
gocql "github.com/apache/cassandra-gocql-driver/v2"
1212
"go.opentelemetry.io/collector/component"
1313
"go.opentelemetry.io/collector/pdata/ptrace"
1414
"go.uber.org/zap"
@@ -43,19 +43,19 @@ func initializeTraceKernel(cfg *Config) error {
4343

4444
defer session.Close()
4545

46-
createDatabaseError := session.Query(parseCreateDatabaseSQL(cfg)).WithContext(ctx).Exec()
46+
createDatabaseError := session.Query(parseCreateDatabaseSQL(cfg)).ExecContext(ctx)
4747
if createDatabaseError != nil {
4848
return createDatabaseError
4949
}
50-
createLinksTypeError := session.Query(parseCreateLinksTypeSQL(cfg)).WithContext(ctx).Exec()
50+
createLinksTypeError := session.Query(parseCreateLinksTypeSQL(cfg)).ExecContext(ctx)
5151
if createLinksTypeError != nil {
5252
return createLinksTypeError
5353
}
54-
createEventsTypeError := session.Query(parseCreateEventsTypeSQL(cfg)).WithContext(ctx).Exec()
54+
createEventsTypeError := session.Query(parseCreateEventsTypeSQL(cfg)).ExecContext(ctx)
5555
if createEventsTypeError != nil {
5656
return createEventsTypeError
5757
}
58-
createSpanTableError := session.Query(parseCreateSpanTableSQL(cfg)).WithContext(ctx).Exec()
58+
createSpanTableError := session.Query(parseCreateSpanTableSQL(cfg)).ExecContext(ctx)
5959
if createSpanTableError != nil {
6060
return createSpanTableError
6161
}
@@ -133,7 +133,7 @@ func (e *tracesExporter) pushTraceData(ctx context.Context, td ptrace.Traces) er
133133
r.EndTimestamp().AsTime().Sub(r.StartTimestamp().AsTime()).Nanoseconds(),
134134
traceutil.StatusCodeStr(status.Code()),
135135
status.Message(),
136-
).WithContext(ctx).Exec()
136+
).ExecContext(ctx)
137137

138138
if insertSpanError != nil {
139139
e.logger.Error("insert span error", zap.Error(insertSpanError))

exporter/cassandraexporter/go.mod

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module github.com/open-telemetry/opentelemetry-collector-contrib/exporter/cassan
33
go 1.24.0
44

55
require (
6-
github.com/gocql/gocql v1.7.0
6+
github.com/apache/cassandra-gocql-driver/v2 v2.0.0
77
github.com/open-telemetry/opentelemetry-collector-contrib/internal/coreinternal v0.140.1
88
github.com/stretchr/testify v1.11.1
99
go.opentelemetry.io/collector/component v1.46.0
@@ -28,7 +28,6 @@ require (
2828
github.com/gobwas/glob v0.2.3 // indirect
2929
github.com/golang/snappy v0.0.4 // indirect
3030
github.com/google/uuid v1.6.0 // indirect
31-
github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed // indirect
3231
github.com/hashicorp/go-version v1.7.0 // indirect
3332
github.com/json-iterator/go v1.1.12 // indirect
3433
github.com/knadh/koanf/maps v0.1.2 // indirect

exporter/cassandraexporter/go.sum

Lines changed: 10 additions & 12 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)