Skip to content

Commit

Permalink
Merge branch 'main' into CAPPL-318
Browse files Browse the repository at this point in the history
  • Loading branch information
justinkaseman authored Dec 12, 2024
2 parents ac8f04d + 0b03fa3 commit 87a0298
Show file tree
Hide file tree
Showing 16 changed files with 728 additions and 34 deletions.
20 changes: 15 additions & 5 deletions pkg/beholder/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
sdklog "go.opentelemetry.io/otel/sdk/log"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
sdkresource "go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/sdk/trace"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
oteltrace "go.opentelemetry.io/otel/trace"
"google.golang.org/grpc/credentials"
Expand Down Expand Up @@ -112,9 +111,13 @@ func newGRPCClient(cfg Config, otlploggrpcNew otlploggrpcFactory) (*Client, erro
// Logger
var loggerProcessor sdklog.Processor
if cfg.LogBatchProcessor {
batchProcessorOpts := []sdklog.BatchProcessorOption{}
if cfg.LogExportTimeout > 0 {
batchProcessorOpts = append(batchProcessorOpts, sdklog.WithExportTimeout(cfg.LogExportTimeout)) // Default is 30s
}
loggerProcessor = sdklog.NewBatchProcessor(
sharedLogExporter,
sdklog.WithExportTimeout(cfg.LogExportTimeout), // Default is 30s
batchProcessorOpts...,
)
} else {
loggerProcessor = sdklog.NewSimpleProcessor(sharedLogExporter)
Expand Down Expand Up @@ -152,9 +155,13 @@ func newGRPCClient(cfg Config, otlploggrpcNew otlploggrpcFactory) (*Client, erro
// Message Emitter
var messageLogProcessor sdklog.Processor
if cfg.EmitterBatchProcessor {
batchProcessorOpts := []sdklog.BatchProcessorOption{}
if cfg.EmitterExportTimeout > 0 {
batchProcessorOpts = append(batchProcessorOpts, sdklog.WithExportTimeout(cfg.EmitterExportTimeout)) // Default is 30s
}
messageLogProcessor = sdklog.NewBatchProcessor(
sharedLogExporter,
sdklog.WithExportTimeout(cfg.EmitterExportTimeout), // Default is 30s
batchProcessorOpts...,
)
} else {
messageLogProcessor = sdklog.NewSimpleProcessor(sharedLogExporter)
Expand Down Expand Up @@ -314,9 +321,12 @@ func newTracerProvider(config Config, resource *sdkresource.Resource, creds cred
if err != nil {
return nil, err
}

batcherOpts := []sdktrace.BatchSpanProcessorOption{}
if config.TraceBatchTimeout > 0 {
batcherOpts = append(batcherOpts, sdktrace.WithBatchTimeout(config.TraceBatchTimeout)) // Default is 5s
}
opts := []sdktrace.TracerProviderOption{
sdktrace.WithBatcher(exporter, trace.WithBatchTimeout(config.TraceBatchTimeout)), // Default is 5s
sdktrace.WithBatcher(exporter, batcherOpts...),
sdktrace.WithResource(resource),
sdktrace.WithSampler(
sdktrace.ParentBased(
Expand Down
20 changes: 15 additions & 5 deletions pkg/beholder/httpclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
sdklog "go.opentelemetry.io/otel/sdk/log"
sdkmetric "go.opentelemetry.io/otel/sdk/metric"
sdkresource "go.opentelemetry.io/otel/sdk/resource"
"go.opentelemetry.io/otel/sdk/trace"
sdktrace "go.opentelemetry.io/otel/sdk/trace"
)

Expand Down Expand Up @@ -77,9 +76,13 @@ func newHTTPClient(cfg Config, otlploghttpNew otlploghttpFactory) (*Client, erro
// Logger
var loggerProcessor sdklog.Processor
if cfg.LogBatchProcessor {
batchProcessorOpts := []sdklog.BatchProcessorOption{}
if cfg.LogExportTimeout > 0 {
batchProcessorOpts = append(batchProcessorOpts, sdklog.WithExportTimeout(cfg.LogExportTimeout)) // Default is 30s
}
loggerProcessor = sdklog.NewBatchProcessor(
sharedLogExporter,
sdklog.WithExportTimeout(cfg.LogExportTimeout), // Default is 30s
batchProcessorOpts...,
)
} else {
loggerProcessor = sdklog.NewSimpleProcessor(sharedLogExporter)
Expand Down Expand Up @@ -117,9 +120,13 @@ func newHTTPClient(cfg Config, otlploghttpNew otlploghttpFactory) (*Client, erro
// Message Emitter
var messageLogProcessor sdklog.Processor
if cfg.EmitterBatchProcessor {
batchProcessorOpts := []sdklog.BatchProcessorOption{}
if cfg.EmitterExportTimeout > 0 {
batchProcessorOpts = append(batchProcessorOpts, sdklog.WithExportTimeout(cfg.EmitterExportTimeout)) // Default is 30s
}
messageLogProcessor = sdklog.NewBatchProcessor(
sharedLogExporter,
sdklog.WithExportTimeout(cfg.EmitterExportTimeout), // Default is 30s
batchProcessorOpts..., // Default is 30s
)
} else {
messageLogProcessor = sdklog.NewSimpleProcessor(sharedLogExporter)
Expand Down Expand Up @@ -181,9 +188,12 @@ func newHTTPTracerProvider(config Config, resource *sdkresource.Resource, tlsCon
if err != nil {
return nil, err
}

batcherOpts := []sdktrace.BatchSpanProcessorOption{}
if config.TraceBatchTimeout > 0 {
batcherOpts = append(batcherOpts, sdktrace.WithBatchTimeout(config.TraceBatchTimeout)) // Default is 5s
}
opts := []sdktrace.TracerProviderOption{
sdktrace.WithBatcher(exporter, trace.WithBatchTimeout(config.TraceBatchTimeout)), // Default is 5s
sdktrace.WithBatcher(exporter, batcherOpts...),
sdktrace.WithResource(resource),
sdktrace.WithSampler(
sdktrace.ParentBased(
Expand Down
90 changes: 90 additions & 0 deletions pkg/capabilities/actions/readcontract/action_builders_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://github.com/smartcontractkit/chainlink-common/pkg/capabilities/actions/readcontract/[email protected]",
"$defs": {
"Config": {
"type": "object",
"properties": {
"ContractReaderConfig": {
"type": "string"
},
"ReadIdentifier": {
"type": "string"
},
"ContractAddress": {
"type": "string"
},
"ContractName": {
"type": "string"
}
},
"required": ["ContractReaderConfig", "ReadIdentifier", "ContractAddress", "ContractName"]
},
"Input": {
"type": "object",
"properties": {
"ConfidenceLevel": {
"type": "string"
},
"Params": {
"type": "object",
"additionalProperties": true
}
},
"required": ["ConfidenceLevel", "Params"]
},
"Output": {
"type": "object",
"properties": {
"LatestValue": {
"type": ["object", "string", "boolean", "null", "array"]
}
},
"required": ["LatestValue"]
}
},
"type": "object",
"properties": {
"Config": {
"$ref": "#/$defs/Config"
},
"Inputs": {
"$ref": "#/$defs/Input"
},
"Outputs": {
"$ref": "#/$defs/Output"
}
}
}
115 changes: 115 additions & 0 deletions pkg/capabilities/actions/readcontract/readcontract_action_generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 87a0298

Please sign in to comment.