I'm new to the world of Opentelemetry and would like to send the Spring-petclinic instrumentation data to Jaeger which is running on my remote cloud system
Here is the bat file:
java -javaagent:opentelemetry-javaagent-all.jar -Dotel.exporter=jaeger -Dotel.exporter.jaeger.endpoint=50.18.XXX.XX:14250 -Dotel.otlp.span.timeout=4000 -Dotel.jaeger.service.name=otel-ui -jar target/spring-petclinic-2.4.0.BUILD-SNAPSHOT.jar
When I run the bat file, I'm abe to open the petclinic app in browser (http://localhost:8080), I get the following error in the console:
[opentelemetry.auto.trace 2021-01-06 17:22:21:008 +0530] [grpc-default-executor-1] WARN io.opentelemetry.exporter.otlp.OtlpGrpcSpanExporter - Failed to export spans. Error message: UNAVAILABLE: io exception
How to resolve this issue? Are there any other dependencies to be the added to the petclinic pom.xml or to the code?
gRPC port isn't enabled in your jaeger instance.
You can try a docker-compose file like this
version: "3.6"
services:
jaeger:
image: jaegertracing/all-in-one
ports:
- 5775:5775/udp
- 6831:6831/udp
- 6832:6832/udp
- 5778:5778
- 16686:16686
- 14268:14268
- 14250:14250
- 9411:9411
And you can connect to it without problems
Can you paste the Collector config file? It seems you are using the gRPC protocol and it's not supported on the system where the collector is running.
https://github.com/open-telemetry/opentelemetry-collector/blob/master/exporter/otlpexporter/README.md
Related
I have moved from spring-cloud-connector to java-cfenv library with all the corresponding changes.
When testing locally - running with setting (VCAP_SERVICES) environment variable and -Dspring.profiles.active=cloud I am able to connect (to remote services like RDS or vault) and run the application just fine.
However when I deploy it to cloudfoundry - each request returns 403 Bad Request.
The manifest for the application looks like this
applications:
- buildpacks:
- https://github.com/cloudfoundry/java-buildpack#v4.38
disk_quota: 1GB
env:
JBP_CONFIG_SPRING_AUTO_RECONFIGURATION: '{ enabled: false }'
SPRING_PROFILES_ACTIVE: cloud
instances: 4
memory: 2GB
name: app-blue
path: ./app.jar
routes:
- route: app-blue.us-east.domain.com
- route: app-blue.com
- route: app.com
services:
- log_drain
- hc_vault
- db_service
stack: cflinuxfs3
In CFlogs, it also shows that that the active profile cloud too, just like locally.
What might be the problem?
Im using kubenetes and I have a pod contain ignite db I added to the pod another container - sscaling/jmx-prometheus-exporter:latest
I read in git I should run this
To run as a javaagent download the jar and run:
java -javaagent:./jmx_prometheus_javaagent-0.14.0.jar=8080:config.yaml -jar yourJar.jar
but I didnt understand, should I also download the file for the kubenrtes container as well?
can someone assist how can I continue from here
I have the following default configuration:
---
hostPort: localhost:5555
username:
password:
rules:
- pattern: ".*"
I am trying to use https://github.com/testcontainers/testcontainers-scala that is inherent from https://www.testcontainers.org/ as the following:
final class MessageSpec extends BddSpec
with ForAllTestContainer
with BeforeAndAfterAll {
override val container = GenericContainer("sweetsoft/sapmock").configure{ c =>
c.addExposedPort(8080)
c.withNetwork(Network.newNetwork())
}
override def beforeAll() {
}
feature("Process incoming messages") {
When I run the test with the command sbt test, I've got the following exception:
15:22:23.171 [pool-7-thread-2] ERROR 🐳 [sweetsoft/sapmock:latest] - Could not start container
org.testcontainers.containers.ContainerLaunchException: Timed out waiting for container port to open (localhost ports: [32775] should be listening)
at org.testcontainers.containers.wait.strategy.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:47)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.wait.HostPortWaitStrategy.waitUntilReady(HostPortWaitStrategy.java:23)
at org.testcontainers.containers.wait.strategy.AbstractWaitStrategy.waitUntilReady(AbstractWaitStrategy.java:35)
at org.testcontainers.containers.GenericContainer.waitUntilContainerStarted(GenericContainer.java:582)
The image is a local image:
docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
sweetsoft/sapmock latest f02be90356e7 3 hours ago 664MB
openjdk 8 bec43387959a 11 days ago 625MB
quay.io/testcontainers/ryuk 0.2.3 64849fd2d464 3 months ago 10.7MB
The question is, why is it waiting for 32775 port? And for what is the port good for?
Update
Maybe this log will help:
15:47:47.274 [pool-7-thread-4] INFO org.testcontainers.dockerclient.DockerClientProviderStrategy - Found Docker environment with Environment variables, system properties and defaults. Resolved:
dockerHost=unix:///var/run/docker.sock
apiVersion='{UNKNOWN_VERSION}'
registryUrl='https://index.docker.io/v1/'
registryUsername='developer'
registryPassword='null'
registryEmail='null'
dockerConfig='DefaultDockerClientConfig[dockerHost=unix:///var/run/docker.sock,registryUsername=developer,registryPassword=<null>,registryEmail=<null>,registryUrl=https://index.docker.io/v1/,dockerConfigPath=/home/developer/.docker,sslConfig=<null>,apiVersion={UNKNOWN_VERSION},dockerConfig=<null>]'
15:47:47.275 [pool-7-thread-4] INFO org.testcontainers.DockerClientFactory - Docker host IP address is localhost
15:47:47.277 [pool-7-thread-4] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: com.github.dockerjava.core.exec.InfoCmdExec#51a07bb5
15:47:47.389 [pool-7-thread-4] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: com.github.dockerjava.core.exec.VersionCmdExec#70fc9b37
15:47:47.392 [pool-7-thread-4] INFO org.testcontainers.DockerClientFactory - Connected to docker:
Server Version: 18.09.6
API Version: 1.39
Operating System: Ubuntu 18.04.2 LTS
Total Memory: 7976 MB
15:47:47.395 [pool-7-thread-4] DEBUG com.github.dockerjava.core.command.AbstrDockerCmd - Cmd: ListImagesCmdImpl[imageNameFilter=quay.io/testcontainers/ryuk:0.2.3,showAll=false,filters=com.github.dockerjava.core.util.FiltersBuilder#0,execution=com.github.dockerjava.core.exec.ListImagesCmdExec#562a343]
15:47:47.417 [pool-7-thread-4] DEBUG org.testcontainers.utility.RegistryAuthLocator - Looking up auth config for image: quay.io/testcontainers/ryuk:0.2.3
15:47:47.417 [pool-7-thread-4] DEBUG org.testcontainers.utility.RegistryAuthLocator - RegistryAuthLocator has configFile: /home/developer/.docker/config.json (does not exist) and commandPathPrefix:
15:47:47.418 [pool-7-thread-4] WARN org.testcontainers.utility.RegistryAuthLocator - Failure when attempting to lookup auth config (dockerImageName: quay.io/testcontainers/ryuk:0.2.3, configFile: /home/developer/.docker/config.json. Falling back to docker-java default behaviour. Exception message: /home/developer/.docker/config.json (No such file or directory)
15:47:47.418 [pool-7-thread-4] DEBUG org.testcontainers.dockerclient.auth.AuthDelegatingDockerClientConfig - Effective auth config [null]
Original java library has answer to your port question.
https://www.testcontainers.org/features/networking/
Note that this exposed port number is from the perspective of the
container.
From the host's perspective Testcontainers actually exposes this on a
random free port. This is by design, to avoid port collisions that may
arise with locally running software or in between parallel test runs.
Because there is this layer of indirection, it is necessary to ask
Testcontainers for the actual mapped port at runtime. This can be done
using the getMappedPort method, which takes the original (container)
port as an argument
In Scala library you can get this mapped port by calling
container.mappedPort(yourExposedPort)
Error is most likely related to this concept, you need to expose that port in advance, inside your docker image. Make sure that you either have expose 8080 command somewhere in your dockerfile or any image that is used to build yours have it
I've been stuck on this for a good bit now and can't find the solution anywhere. I'm writing a java rest service using jersey framework, maven as a package manager hosted on a apache tomcat.
The project works perfectly fine locally. I want to dockerize the application and really struggling. I have the tomcat container up and running and when I go to the root of my application I can see the simple hello text I have. So when I go to http://xxx:8888/npmanager/ at this point I'm seeing what I expect.
Now when I try to hit any of my endpoints i.e https://xxx:8888/npmanager/api/XXX I get a 500 error:
warnings have been detected with resource and/or provider classes:
SEVERE: Missing dependency for field: private org.glassfish.jersey.server.wadl.WadlApplicationContext org.glassfish.jersey.server.wadl.internal.WadlResource.wadlContext
Dockefile:
FROM tomcat:8.5.38
ADD ./target/npmanager.war /usr/local/tomcat/webapps/
CMD chmod +x /usr/local/tomcat/bin/catalina.sh
CMD ["catalina.sh", "run"]
docker-compose.yml
version: '3'
services:
tomcat-dev:
build: .
environment:
TOMCAT_USERNAME: root
TOMCAT_PASSWORD: root
ports:
- "8888:8080"
mysql-dev:
image: mysql:8.0.2
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: npmanager
volumes:
- /mysql-data:/var/lib/mysql
ports:
- "3308:3306"
I am trying to solve what I believe is a common use case for running micro services. In this case I am testing consul with a spring cloud application. I am trying to test consul in two different ways. The first of which is running in a docker container and the other is running on the docker host machine. I am then attempting to start a spring cloud container that will talk with either consul example.
I have been unable to make the spring cloud application talk to consul when the spring cloud application is run as a docker container. When the spring cloud application is run with the host networking mode it works as it can resolve the localhost ports, but this is not an acceptable solution if I wish to run multiple instances of the image.
An example of my docker compose file when running both services as containers is shown below. Here I am attempting to set the consul uri in spring cloud through the environment variables, but have been unable to get it to work using a variety of configurations. If anyone could point to an example of these functions working together that would be immensely helpful.
consul1:
image: progrium/consul
ports:
- "8400:8400"
- "8500:8500"
- "8600:53/udp"
- "8600:53/tcp"
environment:
GOMAXPROCS: 100
entrypoint: "/bin/consul"
hostname: consul
command: agent -log-level=debug -server -config-dir=/config -bootstrap -ui-dir /ui
simpletest:
build: simpletest
hostname: simpletest
environment:
JAVA_OPTS: "-Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n -Dspring.cloud.consul.host=consul1"
ports:
- 39041:7051
- 39052:7055
# d2fdockerroot_consul1_1 consul
# links:
# - consul1
Here you have an example of a brewery system - https://github.com/spring-cloud-samples/brewery. One of the files is a docker-compose file for CONSUL.
https://github.com/spring-cloud-samples/brewery/blob/master/docker-compose-CONSUL.yml
Check out all the application-consul.yaml files that are inside the codebase to see how to set up the Spring Boot apps to talk to consul.
Example: https://github.com/spring-cloud-samples/brewery/blob/master/aggregating/src/main/resources/application-consul.yaml
In case of any issues write here or go to spring-cloud gitter https://gitter.im/spring-cloud/spring-cloud
I had exactly the same problem: linking to my consul container was not enough. However, the following did it for me: As stated here, the corresponding consul host and port configuration needs to be placed in bootstrap.yml, not application.yml.
spring:
cloud:
consul:
host: consul
port: 8500
with the corresponding docker-compose.yml:
version: "2.0"
services:
consul:
image: consul:latest
ports:
- "8500:8500"
my-service:
build: path/to/dockerfile
depends_on:
- consul
links:
- consul:consul