paketo-buildpacks / azure-application-insights Goto Github PK
View Code? Open in Web Editor NEWA Cloud Native Buildpack that contributes the Application Insights Agent and configures it to connect to the service
License: Apache License 2.0
A Cloud Native Buildpack that contributes the Application Insights Agent and configures it to connect to the service
License: Apache License 2.0
For nodejs app, during the detect pahse, the paketo-buildpacks/azure-application-insights didn't be detected
when using legacy binding, the build failed.
Here is the build spec:
Here is the error logs:
Build reason(s): CONFIG
CONFIG:
�[31m-�[0m �[31mresources: {}�[0m
�[31m-�[0m �[31msource: {}�[0m
�[32m+�[0m �[32mcnbBindings:�[0m
�[32m+�[0m �[32m- metadataRef:�[0m
�[32m+�[0m �[32m name: buildservices.default.builders.default.buildpackbindings.default.type.applicationinsights.metadata�[0m
�[32m+�[0m �[32m name: 7default-7default-7default-1�[0m
�[32m+�[0m �[32m secretRef:�[0m
�[32m+�[0m �[32m name: buildservices.default.builders.default.buildpackbindings.default.type.applicationinsights.secret�[0m
�[32m+�[0m �[32mresources:�[0m
�[32m+�[0m �[32m limits:�[0m
�[32m+�[0m �[32m cpu: "1"�[0m
�[32m+�[0m �[32m memory: 1Gi�[0m
�[32m+�[0m �[32m requests:�[0m
�[32m+�[0m �[32m cpu: "0"�[0m
�[32m+�[0m �[32m memory: "0"�[0m
�[32m+�[0m �[32msource:�[0m
�[32m+�[0m �[32m blob:�[0m
�[32m+�[0m �[32m url: https://a83b1b7b0e514335b6fa70df.file.core.windows.net/2e688e5754b2413f9fee11449afbab42/resources/2022021704-f705c3f0-d14a-4fde-8452-c9eda50ed893?sv=2018-03-28&sr=f&sig=gQaEuVFT53m%2Feocd9ruCMsjV5CXXqYd%2BwEH1Hbf8rik%3D&se=2022-02-18T04%3A37%3A52Z&sp=r�[0m
Loading secrets for "acrda49c26bd8a84fd59.azurecr.io" from secret "docker-kpack"
Downloading a83b1b7b0e514335b6fa70df.file.core.windows.net/2e688e5754b2413f9fee11449afbab42/resources/2022021704-f705c3f0-d14a-4fde-8452-c9eda50ed893...
Successfully downloaded a83b1b7b0e514335b6fa70df.file.core.windows.net/2e688e5754b2413f9fee11449afbab42/resources/2022021704-f705c3f0-d14a-4fde-8452-c9eda50ed893 in path "/workspace"
Previous image with name "acrda49c26bd8a84fd59.azurecr.io/build-service-result-image-2e688e5754b2413f9fee11449afbab42-default-app1:result-1" not found
6 of 17 buildpacks participating
paketo-buildpacks/ca-certificates 2.4.1
tanzu-buildpacks/node-engine 0.6.0
tanzu-buildpacks/yarn 0.2.1
tanzu-buildpacks/yarn-install 0.2.1
tanzu-buildpacks/node-module-bom 0.1.1
tanzu-buildpacks/yarn-start 0.2.0
�[34m�[0m
�[34m�[1mPaketo CA Certificates Buildpack�[0m�[34m 2.4.1�[0m
�[34;2;3mhttps://github.com/paketo-buildpacks/ca-certificates�[0m
�[34mLaunch Helper�[0m: �[33mContributing�[0m to layer
�[2m Creating /layers/paketo-buildpacks_ca-certificates/helper/exec.d/ca-certificates-helper�[0m
Tanzu Node Engine Buildpack 0.6.0
Resolving Node Engine version
Candidate version sources (in priority order):
-> ""
-> ""
Selected Node Engine version (using ): 14.17.6
Executing build process
Installing Node Engine 14.17.6
failure checking for dependency mappings: couldn't read binding type: open /platform/bindings/7default-7default-7default-1/type: no such file or directory
�[31;1mERROR: �[0mfailed to build: exit status 1
when using the servicebinding, the build succeeded but paketo-buildpacks/azure-application-insights didn't participate to the build.
Here is the build spec:
In both situations, the paketo-buildpacks/azure-application-insights didn't be detected.
What platform (pack
, kpack
, tekton
buildpacks plugin, etc.) are you
using? Please include a version.
kpack0.5.0
What buildpacks are you using? Please include versions.
tanzu-buildpacks/java-azure 7.3.0
tanzu-buildpacks/nodejs 1.11.0
What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>
?
Can you provide a sample app or relevant configuration (buildpack.yml
,
nginx.conf
, etc.)?
https://github.com/digitalocean/sample-nodejs
We are using paketo buildpacks to create our container image for Java Springboot application. paketo-buildpacks/azure-application-insights is one of the buildpacks included to create our container image. Our Azue DevOps pipeline create container image using spring boot command “mvn spring-boot:build-image”.
Here is our “spring-boot-maven-plugin” config:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<buildpacks>
<buildpack>paketo-buildpacks/ca-certificates</buildpack>
<buildpack>gcr.io/paketo-buildpacks/microsoft-openjdk</buildpack>
<buildpack>paketo-buildpacks/syft</buildpack>
<buildpack>paketo-buildpacks/executable-jar</buildpack>
<buildpack>paketo-buildpacks/dist-zip</buildpack>
<buildpack>paketo-buildpacks/spring-boot</buildpack>
<buildpack>gcr.io/paketo-buildpacks/azure-application-insights</buildpack>
</buildpacks>
<createdDate>now</createdDate>
<bindings>${project.basedir}/appinsights:/platform/bindings/application-insights</bindings>
</image>
</configuration>
</plugin>
Creating container image was working fine until few days ago. But suddenly it started failing. When we looked, we found the difference between the last successful build and the failed one is the Azure App Insight buildpack version. The build was successful with version 5.18.3 but failing with version “5.19.0”. See failure message below;
Successfully create container image and include Azure App Insight Jar in the image.
Image creation fails with "open /cnb/buildpacks/paketo-buildpacks_azure-application-insights/5.19.0/resources/AI-Agent.xml: no such file or directory". See the error details:
[INFO] [creator]
[INFO] [creator] Paketo Buildpack for Azure Application Insights 5.19.0
[INFO] [creator] https://github.com/paketo-buildpacks/azure-application-insights
[INFO] [creator] Azure Application Insights Java Agent 3.5.1: Contributing to layer
[INFO] [creator] Downloading from https://github.com/microsoft/ApplicationInsights-Java/releases/download/3.5.1/applicationinsights-agent-3.5.1.jar
[INFO] [creator] Verifying checksum
[INFO] [creator] Copying to /layers/paketo-buildpacks_azure-application-insights/azure-application-insights-java
[INFO] [creator] unable to invoke layer creator
[INFO] [creator] unable to open /cnb/buildpacks/paketo-buildpacks_azure-application-insights/5.19.0/resources/AI-Agent.xml
[INFO] [creator] open /cnb/buildpacks/paketo-buildpacks_azure-application-insights/5.19.0/resources/AI-Agent.xml: no such file or directory
[INFO] [creator] ERROR: failed to build: exit status 1
Our build process runs with Java 17, Spring boot 3.2 on Ubuntu Linux and we use “mvn spring-boot:build-image” command to create the image. See above the definition of 'spring-boot-maven-plugin'
Also, wondering is there a way to define the specific version of azure-application-insights build pack in spring-boot-maven-plugin in 'pom.xml?
Unable to create docker image for a spring based application using spring-boot-maven-plugin
POM Configuration:
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.5.3</version>
<executions>
<execution>
<goals>
<goal>build-image</goal>
</goals>
</execution>
</executions>
<configuration>
<layers>
<enabled>true</enabled>
</layers>
<image>
<builder>gcr.io/paketo-buildpacks/builder:base</builder>
<buildpacks>
<buildpack>gcr.io/paketo-buildpacks/azul-zulu:latest</buildpack>
<buildpack>gcr.io/paketo-buildpacks/azure-application-insights:latest</buildpack>
<buildpack>gcr.io/paketo-buildpacks/executable-jar:latest</buildpack>
<buildpack>gcr.io/paketo-buildpacks/spring-boot:latest</buildpack>
</buildpacks>
<env>
<BP_JVM_VERSION>11.*</BP_JVM_VERSION>
</env>
</image>
</configuration>
</plugin>
I get below error when I try to build the image.
I introduced azure application insight buildpack and expecting the docker image to be created.
Building image 'docker.io/library/greeter-rest:1.0.0-SNAPSHOT'
[INFO]
[INFO] > Pulling builder image 'gcr.io/paketo-buildpacks/builder:base' 100%
[INFO] > Pulled builder image 'gcr.io/paketo-buildpacks/builder@sha256:d8f18179799bb7435612d24dd3e1d1fabb057420ee853affed3645fb6f24808b'
[INFO] > Pulling run image 'docker.io/paketobuildpacks/run:base-cnb' 100%
[INFO] > Pulled run image 'paketobuildpacks/run@sha256:781ccd109ecd2b800422697313035a2c37378ff26b6fa97d5205566197bcbb79'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/azul-zulu:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/azul-zulu@sha256:d698019a7dea016a877df28dfa0d329bb723eade550acaf9a169b16d0c19111d'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/azure-application-insights:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/azure-application-insights@sha256:72328be7c84b0c19760bc2aa9eedf5b30c8d844223cf89ca4c366c38dc3fedd8'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/executable-jar:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/executable-jar@sha256:a1e16a58b2eb6d6e2ea2b6800fcc0c76cd3d15c63e00300c8ed95b6bc393fc98'
[INFO] > Pulling buildpack image 'gcr.io/paketo-buildpacks/spring-boot:latest' 100%
[INFO] > Pulled buildpack image 'gcr.io/paketo-buildpacks/spring-boot@sha256:cf1e36a8cf52824c15349692d5dbaaf575f588acf0e203a04376092fe49e2985'
[INFO] > Executing lifecycle version v0.12.0
[INFO] > Using build cache volume 'pack-cache-2f939f4c5fde.build'
[INFO]
[INFO] > Running creator
[INFO] [creator] ===> DETECTING
[INFO] [creator] ERROR: No buildpack groups passed detection.
[INFO] [creator] ERROR: Please check that you are running against the correct path.
[INFO] [creator] ERROR: failed to detect: no buildpacks participating
pack
, kpack
, tekton
buildpacks plugin, etc.) are youspring boot maven plugin
What buildpacks are you using? Please include versions.
latest
What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>
?
Can you provide a sample app or relevant configuration (buildpack.yml
,
nginx.conf
, etc.)?
Add dotnet application insights package to azure-application-insights/buildpack.toml
[[metadata.dependencies]]
id = "Microsoft.ApplicationInsights.AutoInstrumentation"
name = "Azure Application Insights Dotnet Agent"
sha256 = "placeholder"
stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"]
uri = "https://www.nuget.org/api/v2/package/Microsoft.ApplicationInsights.AutoInstrumentation/2.8.42-beta1"
version = "2.8.42-beta1"
[[metadata.dependencies.licenses]]
type = "MIT"
uri = "https://github.com/microsoft/ApplicationInsights-dotnet/blob/develop/LICENSE"
Following are the steps to download and enable Application Insights Auto-Instrumentation.
/tmp
DOTNET_STARTUP_HOOKS=/tmp/core/StartupHook/Microsoft.ApplicationInsights.StartupHook.dll
ASPNETCORE_HOSTINGSTARTUPASSEMBLIES=Microsoft.ApplicationInsights.StartupBootstrapper
APPLICATIONINSIGHTS_CONNECTION_STRING=<Your Connection String>
I have below image.yml which can capture the layer of agent but keep rasing Please provide connection string or instrumentation key. when docker run.
As I understanding, it should match the Binding
structure as below but looks little mismatch for this structure. Is there any example for this scenarios ? Thanks a lot.
// Binding is a projection of metadata about an external entity to be bound to.
type Binding struct {
// Name is the name of the binding
Name string
// Path is the path to the binding directory.
Path string
// Type is the type of the binding.
Type string
// Provider is the optional provider of the binding.
Provider string
// Secret is the secret of the binding.
Secret map[string]string
}
...
build:
bindings:
- name: appinsights
type: ApplicationInsights
secretRef:
name: secret
metadataRef:
name: configmap
---
apiVersion: v1
kind: ConfigMap
metadata:
name: configmap
namespace: build-service
data:
kind: maven
provider: test-meta
type: ApplicationInsights
---
apiVersion: v1
kind: Secret
metadata:
name: secret
namespace: build-service
stringData:
CONNECTION_STRING: "xxxxx"
Error logs
Setting Active Processor Count to 8
Calculating JVM memory based on 24543008K available memory
Calculated JVM Memory Configuration: -XX:MaxDirectMemorySize=10M -Xmx24145852K -XX:MaxMetaspaceSize=89955K -XX:ReservedCodeCacheSize=240M -Xss1M (Total Memory: 24543008K, Thread Count: 50, Loaded Class Count: 13468, Headroom: 0%)
Adding 129 container CA certificates to JVM truststore
Spring Cloud Bindings Enabled
Picked up JAVA_TOOL_OPTIONS: -Djava.security.properties=/layers/paketo-buildpacks_azul-zulu/java-security-properties/java-security.properties -agentpath:/layers/paketo-buildpacks_azul-zulu/jvmkill/jvmkill-1.16.0-RELEASE.so=printHeapHistogram=1 -javaagent:/layers/paketo-buildpacks_azure-application-insights/azure-application-insights-java/applicationinsights-agent-3.1.0.jar -XX:ActiveProcessorCount=8 -XX:MaxDirectMemorySize=10M -Xmx24145852K -XX:MaxMetaspaceSize=89955K -XX:ReservedCodeCacheSize=240M -Xss1M -Dorg.springframework.cloud.bindings.boot.enable=true
2021-06-28 10:30:11.080Z ERROR c.m.applicationinsights.agent -
*************************
ApplicationInsights Java Agent 3.1.0 failed to start
*************************
Description:
No connection string or instrumentation key provided
Action:
Please provide connection string or instrumentation key.
What were you attempting to do?
What did you expect to happen?
What was the actual behavior? Please provide log output, if possible.
What platform (pack
, kpack
, tekton
buildpacks plugin, etc.) are you
using? Please include a version.
What buildpacks are you using? Please include versions.
What builder are you using? If custom, can you provide the output from pack inspect-builder <builder>
?
Can you provide a sample app or relevant configuration (buildpack.yml
,
nginx.conf
, etc.)?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.