Skip to content

Commit 77d5902

Browse files
authored
Merge pull request #1369 from microsoft/fix-native-perf-counters
Fix native perf counters for now
2 parents f1c52a1 + 0bbf6f2 commit 77d5902

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

core/build.gradle

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ clean {
3636
delete "${System.properties['java.io.tmpdir']}/AISDK/native" // see JniPCConnector.java for jni directory
3737
}
3838

39+
// CURRENTLY the DLL being built on CI is not working, leading to this error on startup:
40+
//
41+
// ERROR c.m.a.i.perfcounter.JniPCConnector - Unexpected error initializing JNI Performance Counter library. Windows performance counters will not be used
42+
// java.lang.UnsatisfiedLinkError: C:\Users\trstalna\AppData\Local\Temp\AISDK\native\3.0.0-PREVIEW.7-SNAPSHOT\applicationinsights-core-native-win64.dll: Can't find dependent libraries
43+
//
44+
// and native windows perf counters do not get collected
45+
//
46+
// so instead of building the DLLs, we are currently just copying the previously built DLLs from 2.6.2 which work fine
47+
// (see copyTheDLL task below)
48+
49+
/*
3950
import org.apache.tools.ant.taskdefs.condition.Os
4051
4152
boolean skipWinNative = (System.properties['skipWinNative'] ?: 'false').toBoolean()
@@ -52,13 +63,18 @@ if (skipWinNative) {
5263
logger.warn("Native binaries build is only supported on Windows systems; native components will not be built.")
5364
}
5465
}
66+
*/
5567

5668
import com.microsoft.applicationinsights.build.tasks.PropsFileGen
5769

5870
archivesBaseName = 'applicationinsights-core'
5971

6072
apply from: "$buildScriptsDir/provided-configuration.gradle"
6173

74+
configurations {
75+
forTheDLL { transitive = false }
76+
}
77+
6278
dependencies {
6379
compile ([group: 'eu.infomas', name: 'annotation-detector', version: '3.0.5'])
6480
compile ([group: 'commons-io', name: 'commons-io', version: '2.6' ])
@@ -77,8 +93,19 @@ dependencies {
7793
testCompile group: 'junit', name: 'junit', version: '4.12'
7894
testCompile group: 'com.google.code.gson', name: 'gson', version: '2.8.2'
7995
testCompile group: 'com.github.stefanbirkner', name: 'system-rules', version: '1.19.0'
96+
97+
forTheDLL 'com.microsoft.azure:applicationinsights-core:2.6.2'
8098
}
8199

100+
task copyTheDLL(type: Copy) {
101+
from zipTree(configurations.forTheDLL.singleFile).matching {
102+
include '*.dll'
103+
}
104+
into "$buildDir/resources/main"
105+
}
106+
107+
processResources.dependsOn copyTheDLL
108+
82109
task generateVersionProperties(type: PropsFileGen) {
83110
targetFile = new File(sdkVersionFileDir, "sdk-version.properties")
84111
property "version", project.version

0 commit comments

Comments
 (0)