Skip to content

Commit dfd06fe

Browse files
committed
feat: fix fstring
1 parent 55ef090 commit dfd06fe

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

scripts/collector/sqlserver/dmaSQLServerPerfmonDataset.ps1

+14-14
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ if ($namedInstanceName) {
100100
else {
101101
$perfmonLogFile = 'opdb__perfMonLog' + '__' + $operation + '_' + $machinename + '_MSSQLSERVER_' + $current_ts + '.log'
102102
if (!$perfmonOutFile) {
103-
$perfmonOutFile = 'opdb__PerfMonData' + '_' + $machinename + '_MSSQLSERVER_' + $current_ts + '.csv'
103+
$perfmonOutFile = 'opdb__PerfMonData' + '_' + $machinename + '_MSSQLSERVER_' + $current_ts + '.csv'
104104
}
105105
}
106106

@@ -241,7 +241,7 @@ function CreateDMAPerfmonDataSet {
241241
</EventsFileName>
242242
</DataManager>
243243
</DataCollectorSet>
244-
'@
244+
'@
245245
}
246246
else {
247247
$str = @'
@@ -401,12 +401,12 @@ function CreateDMAPerfmonDataSet {
401401
Remove-Item -Path $env:TEMP\DMA-SQLServerPerfmonDataSet.xml
402402
}
403403
}
404-
405-
404+
405+
406406
$newXML = $str.Replace('$instance', $metricInstanceName).Replace('$dataset', $dataSet)
407407
$newXML = $newXML.Replace('$perfmonDuration', $perfmonDuration).Replace('$perfmonSampleInterval', $perfmonSampleInterval)
408408
$newXML = $newXML.Replace('$perfmonTotalDuration', $perfmonTotalDuration)
409-
409+
410410
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage " " -logOperation "BOTH"
411411
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage "Writing XML File to be used for import to perfmon..." -logOperation "BOTH"
412412
$newXML | Out-File -FilePath $xmlTempDir\DMA-SQLServerPerfmonDataSet.xml -encoding utf8
@@ -531,7 +531,7 @@ function CollectDMAPerfmonDataSet {
531531
[string]$dmaSourceId,
532532
[string]$dmaManualId
533533
)
534-
534+
535535
$outputDir = $PSScriptRoot + "\" + $perfmonOutDir
536536
$outputFileName = $perfmonOutFile
537537
$maxFileDate = $null
@@ -561,9 +561,9 @@ function CollectDMAPerfmonDataSet {
561561
$tempFileName = 'PKEY_' + (Split-Path $file -leaf)
562562
Get-Content -Path $file | ForEach-Object {
563563
# Old way of splitting file
564-
#$arr = $_.ToString() -split ','
564+
#$arr = $_.ToString() -split ','
565565
#$left = $arr[0..($arr.Length-3)] -join ','
566-
#$right = $arr[($arr.Length-2)..($arr.Length-1)] -join ','
566+
#$right = $arr[($arr.Length-2)..($arr.Length-1)] -join ','
567567
#'"' + $pkey + '",' + $left + ',"' + $dmaSourceId + '","' + $dmaManualId + '",' + $right
568568
#New file split method
569569
$perfmonCsv = $_.ToString() -split ','
@@ -586,7 +586,7 @@ function CollectDMAPerfmonDataSet {
586586
$tempContent = '"PKEY"|"COLLECTION_TIME"|"AVAILABLE_MBYTES"|"PHYSICALDISK_AVG_DISK_BYTES_READ"|"PHYSICALDISK_AVG_DISK_BYTES_WRITE"|"PHYSICALDISK_AVG_DISK_BYTES_READ_SEC"|"PHYSICALDISK_AVG_DISK_BYTES_WRITE_SEC"|"PHYSICALDISK_DISK_READS_SEC"|"PHYSICALDISK_DISK_WRITES_SEC"|"PROCESSOR_IDLE_TIME_PCT"|"PROCESSOR_TOTAL_TIME_PCT"|"PROCESSOR_FREQUENCY"|"PROCESSOR_QUEUE_LENGTH"|"BUFFER_CACHE_HIT_RATIO"|"CHECKPOINT_PAGES_SEC"|"FREE_LIST_STALLS_SEC"|"PAGE_LIFE_EXPECTANCY"|"PAGE_LOOKUPS_SEC"|"PAGE_READS_SEC"|"PAGE_WRITES_SEC"|"USER_CONNECTION_COUNT"|"MEMORY_GRANTS_PENDING"|"TARGET_SERVER_MEMORY_KB"|"TOTAL_SERVER_MEMORY_KB"|"BATCH_REQUESTS_SEC"|"DMA_SOURCE_ID"|"DMA_MANUAL_ID"|"NUMA_TOTAL_MEMORY_MB"|"NUMA_AVAILABLE_MEMORY_MB"'
587587
if ($fileExists) {
588588
Set-Content -Path $outputDir\$outputFileName -Value $tempContent -Encoding utf8
589-
589+
590590
((Get-Content -Path $env:TEMP\PKEY_*$dataSet*.csv -Raw ) -replace ',', '|') | Add-Content -Encoding utf8 -Path $outputDir\$outputFileName
591591
}
592592
else {
@@ -603,7 +603,7 @@ function CollectDMAPerfmonDataSet {
603603
$tempContent = '"' + $pkey + '"|"' + $tempDate + '"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"0"|"' + $dmaSourceId + '"|"' + $dmaManualId + '"|"0"|"0"'
604604
Add-Content -Path $outputDir\$outputFileName -Value $tempContent -Encoding utf8
605605

606-
}
606+
}
607607
if (Test-Path -Path $outputDir\$outputFileName) {
608608
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage "Clean up Temp File area..." -logOperation "BOTH"
609609
Remove-Item -Path $env:TEMP\*$dataSet*.csv
@@ -627,7 +627,7 @@ function CreateEmptyFile {
627627
[string]$dmaSourceId,
628628
[string]$dmaManualId
629629
)
630-
630+
631631
$outputDir = $PSScriptRoot + "\" + $perfmonOutDir
632632
$outputFileName = $perfmonOutFile
633633
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage "Creating an empty Google DMA SQL Server Perfmon Counter Data Set..." -logOperation "BOTH"
@@ -636,7 +636,7 @@ function CreateEmptyFile {
636636
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage " " -logOperation "FILE"
637637
WriteLog -logLocation $foldername\$logFile -logMessage "DMA Manual Id: $dmaManualId " -logOperation "FILE"
638638
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage " " -logOperation "FILE"
639-
639+
640640
if (!(Test-Path -PathType container $outputDir)) {
641641
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage " " -logOperation "BOTH"
642642
WriteLog -logLocation $outputDir\$perfmonLogFile -logMessage "Creating Output Directory..." -logOperation "BOTH"
@@ -671,7 +671,7 @@ function CreateEmptyFile {
671671
}
672672

673673
if (!$operation) {
674-
$operation = read-host -Prompt "Enter an operation: create, stop, delete, collect, createemptyfile"
674+
$operation = read-host -Prompt "Enter an operation: create, stop, delete, collect, createemptyfile"
675675
}
676676
if ($namedInstanceName) {
677677
$datasetName = "Google-DMA-SQLServerDataSet-$namedInstanceName"
@@ -709,4 +709,4 @@ elseif ($operation.ToLower() -eq "status") {
709709
}
710710
else {
711711
Write-Output "Operation $operation specified is invalid"
712-
}
712+
}

src/dma/cli/main.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ async def _readiness_check(
325325
) -> None:
326326
async_engine = get_engine(db_type, username, password, hostname, port, database)
327327
working_path = working_path or Path("tmp/")
328-
execution_id = f"{db_type}_{current_version!s}_{datetime.now(tz=timezone.utc).strftime("%y%m%d%H%M%S")}"
328+
execution_id = f"{db_type}_{current_version!s}_{datetime.now(tz=timezone.utc).strftime('%y%m%d%H%M%S')}"
329329
with get_duckdb_connection(working_path) as local_db:
330330
async with AsyncSession(async_engine) as db_session:
331331
collection_manager = await anext(

0 commit comments

Comments
 (0)