-
Notifications
You must be signed in to change notification settings - Fork 441
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into hannahkm/add-codeowners
- Loading branch information
Showing
24 changed files
with
749 additions
and
26 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016 Datadog, Inc. | ||
|
||
package valkey_test | ||
|
||
import ( | ||
"context" | ||
"log" | ||
|
||
"github.com/valkey-io/valkey-go" | ||
valkeytrace "gopkg.in/DataDog/dd-trace-go.v1/contrib/valkey-go" | ||
"gopkg.in/DataDog/dd-trace-go.v1/ddtrace/tracer" | ||
) | ||
|
||
// To start tracing Valkey, simply create a new client using the library and continue | ||
// using as you normally would. | ||
func Example() { | ||
tracer.Start() | ||
defer tracer.Stop() | ||
|
||
vk, err := valkeytrace.NewClient(valkey.ClientOption{ | ||
InitAddress: []string{"localhost:6379"}, | ||
}) | ||
if err != nil { | ||
log.Fatal(err) | ||
return | ||
} | ||
|
||
if err := vk.Do(context.Background(), vk.B().Set().Key("key").Value("value").Build()).Error(); err != nil { | ||
log.Fatal(err) | ||
return | ||
} | ||
} |
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,42 @@ | ||
// Unless explicitly stated otherwise all files in this repository are licensed | ||
// under the Apache License Version 2.0. | ||
// This product includes software developed at Datadog (https://www.datadoghq.com/). | ||
// Copyright 2016 Datadog, Inc. | ||
|
||
package valkey | ||
|
||
import ( | ||
"gopkg.in/DataDog/dd-trace-go.v1/internal" | ||
"gopkg.in/DataDog/dd-trace-go.v1/internal/namingschema" | ||
) | ||
|
||
type config struct { | ||
rawCommand bool | ||
serviceName string | ||
} | ||
|
||
// Option represents an option that can be used to create or wrap a client. | ||
type Option func(*config) | ||
|
||
func defaultConfig() *config { | ||
return &config{ | ||
// Do not include the raw command by default since it could contain sensitive data. | ||
rawCommand: internal.BoolEnv("DD_TRACE_VALKEY_RAW_COMMAND", false), | ||
serviceName: namingschema.ServiceName(defaultServiceName), | ||
} | ||
} | ||
|
||
// WithRawCommand can be used to set a tag `valkey.raw_command` in the created spans (disabled by default). | ||
// Warning: please note the datadog-agent currently does not support obfuscation for this tag, so use this at your own risk. | ||
func WithRawCommand(rawCommand bool) Option { | ||
return func(cfg *config) { | ||
cfg.rawCommand = rawCommand | ||
} | ||
} | ||
|
||
// WithServiceName sets the given service name for the client. | ||
func WithServiceName(name string) Option { | ||
return func(cfg *config) { | ||
cfg.serviceName = name | ||
} | ||
} |
Oops, something went wrong.