Skip to content

Commit

Permalink
add headers field to exporter struct
Browse files Browse the repository at this point in the history
  • Loading branch information
huyan0 committed Aug 4, 2020
1 parent 9a69f18 commit cf8fcaf
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
1 change: 0 additions & 1 deletion exporter/cortexexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ type Config struct {
exporterhelper.TimeoutSettings `mapstructure:",squash"` // squash ensures fields are correctly decoded in embedded struct.
exporterhelper.QueueSettings `mapstructure:"sending_queue"`
exporterhelper.RetrySettings `mapstructure:"retry_on_failure"`

// Namespace if set, exports metrics under the provided value.
Namespace string `mapstructure:"namespace"`

Expand Down
3 changes: 2 additions & 1 deletion exporter/cortexexporter/cortex.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ import (
otlp "go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/metrics/v1"

)

// TODO: get default labels such as job or instance from Resource
type cortexExporter struct {
namespace string
endpoint string
client *http.Client
headers map[string]string
wg *sync.WaitGroup
closeChan chan struct{}
}
Expand Down
3 changes: 2 additions & 1 deletion exporter/cortexexporter/cortex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ import (
// "github.com/stretchr/testify/require"
)

// TODO: try to run Test_PushMetrics after export is in
// TODO: try to run Test_PushMetrics after export() is in
// TODO: add bucket and histogram test cases for Test_PushMetrics
// TODO: check that NoError instead of NoNil is used at the right places

//return false if descriptor type is nil
func Test_validateMetrics(t *testing.T) {
Expand Down
27 changes: 10 additions & 17 deletions exporter/cortexexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,38 +12,31 @@ exporters:
Prometheus-Remote-Write-Version: "0.1.0"
Tenant-id: 234
another: "somevalue"

namespace: ""

#A lot of this will be rewritten
timeout: 10s
reconnection_delay: 15
compression: "on"
num_workers: 4
namespace: "prefix"
const_labels:
label1: value1
label2: value2


basic_auth: #Nope
username: "username"
password: "1234"
password_file: "yes"
http_config:
# CA certificate to validate API server certificate with.
http_endpoint: "localhost:8888"
endpoint: "localhost:8888"
tls_config:
ca_file: /var/lib/mycert.pem
read_buffer:

write_buffer:
read_buffer_size:
write_buffer:
timeout: 5s

# ServerName extension to indicate the name of the server.
# https://tools.ietf.org/html/rfc4366#section-3.







service:
service:
pipelines:
traces:
receivers: [examplereceiver]
Expand Down

0 comments on commit cf8fcaf

Please sign in to comment.