Skip to content

Commit

Permalink
Copy tracing (#240)
Browse files Browse the repository at this point in the history
Co-authored-by: alonadam <[email protected]>
  • Loading branch information
t-ronmoneta and alonadam authored Apr 9, 2024
1 parent 69fbfdb commit 5b77eb9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
7 changes: 6 additions & 1 deletion kusto/ingest/ingest.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ type Ingestion struct {

bufferSize int
maxBuffers int

applicationForTracing string
clientVersionForTracing string
}

// Option is an optional argument to New().
Expand All @@ -63,12 +66,14 @@ func New(client QueryClient, db, table string, options ...Option) (*Ingestion, e
db: db,
table: table,
}
i.applicationForTracing = client.ClientDetails().ApplicationForTracing()
i.clientVersionForTracing = client.ClientDetails().ClientVersionForTracing()

for _, option := range options {
option(i)
}

fs, err := queued.New(db, table, mgr, client.HttpClient(), queued.WithStaticBuffer(i.bufferSize, i.maxBuffers))
fs, err := queued.New(db, table, mgr, client.HttpClient(), i.applicationForTracing, i.clientVersionForTracing, queued.WithStaticBuffer(i.bufferSize, i.maxBuffers))
if err != nil {
return nil, err
}
Expand Down
4 changes: 4 additions & 0 deletions kusto/ingest/internal/properties/properties.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,10 @@ type Ingestion struct {
Additional Additional `json:"AdditionalProperties"`
// TableEntryRef points to the staus table entry used to report the status of this ingestion.
TableEntryRef StatusTableDescription `json:"IngestionStatusInTable,omitempty"`
// ApplicationForTracing is the application name that is used for tracing.
ApplicationForTracing string `json:",omitempty"`
// ClientVersionForTracing is the client version that is used for tracing.
ClientVersionForTracing string `json:",omitempty"`
}

// Additional is additional properites.
Expand Down
9 changes: 8 additions & 1 deletion kusto/ingest/internal/queued/queued.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ type Ingestion struct {

bufferSize int
maxBuffers int

applicationForTracing string
clientVersionForTracing string
}

// Option is an optional argument to New().
Expand All @@ -80,7 +83,7 @@ func WithStaticBuffer(bufferSize int, maxBuffers int) Option {
}

// New is the constructor for Ingestion.
func New(db, table string, mgr *resources.Manager, http *http.Client, options ...Option) (*Ingestion, error) {
func New(db, table string, mgr *resources.Manager, http *http.Client, applicationForTracing string, clientVersionForTracing string, options ...Option) (*Ingestion, error) {
i := &Ingestion{
db: db,
table: table,
Expand All @@ -94,6 +97,8 @@ func New(db, table string, mgr *resources.Manager, http *http.Client, options ..
options *azblob.UploadFileOptions) (azblob.UploadFileResponse, error) {
return client.UploadFile(ctx, container, blob, file, options)
},
applicationForTracing: applicationForTracing,
clientVersionForTracing: clientVersionForTracing,
}

for _, opt := range options {
Expand Down Expand Up @@ -246,6 +251,8 @@ func (i *Ingestion) Blob(ctx context.Context, from string, fileSize int64, props
}

props.Ingestion.RetainBlobOnSuccess = !props.Source.DeleteLocalSource
props.Ingestion.ApplicationForTracing = i.applicationForTracing
props.Ingestion.ClientVersionForTracing = i.clientVersionForTracing

err := CompleteFormatFromFileName(&props, from)
if err != nil {
Expand Down

0 comments on commit 5b77eb9

Please sign in to comment.