Statsd "Bad Line" error when sending UDP data using Micrometer - statsd

When sending Statsd packages from my app to Statsd server, we can see the following Bad line error in the statsd server:
DEBUG: Bad line: value,name in msg jdbc.connections.min:10|g|#statistic:value,name:dataSource"
Since I'm using the Micrometer maven dependancy of:
<dependency>
<groupId>io.micrometer</groupId>
<artifactId>micrometer-registry-statsd</artifactId>
<version>1.0.3</version>
</dependency>
I'm note sure how to control this value,name property

The problem was due to the flavor of the Statsd we used.
There are several Statsd flavors (Etsy, Datadog & Telegraf).
As we changed the configuration to be:
management.metrics.export.statsd.flavor=etsy
The graphite was no longer dropping the packets and received them correctly.

Related

ActiveMQ Artemis broker and Spring Boot - prevent from starting embedded

I have a project, where I want to use ActiveMQ Artemis with Spring Boot 3.0.1, but I have an issue with embedded server.
Dependencies used:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-artemis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.activemq</groupId>
<artifactId>artemis-jms-server</artifactId>
</dependency>
The drill should be: when needed, start embedded server, but there is no need for that, connect to existing instance.
From I understand, there are two parameters, that might be useful here:
spring.artemis.mode - I should set it whenever want to start embedded service or connect to native instance of the server and:
spring.artemis.embedded.enabled - Quote from documentation, "Whether to enable embedded mode if the Artemis server APIs are available."
All that said, setting first one to native and second one to false does not do the trick. Native server is still starting. Am I missing something? Is there a simple way to tell Spring Boot via property or any other way to not start server if not needed?
EDIT1:
Maybe I'll provide some more details.
All configuration for the Artemis goes into separate module, where dependencies that has been provided above are.
Then, this module (let's call it "message") has only following properties:
spring:
artemis:
broker-url: tcp://localhost:61616
mode: native
Then, other module has than module as a dependency (has changed names of the groupId and artifactId for simplicity):
<dependency>
<groupId>org.example.company</groupId>
<artifactId>message</artifactId>
</dependency>
Then, changing the value in the properties does nothing to starting the server, in both configurations I see in logs:
2023-01-23T11:41:18.445+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221000: live Message Broker is starting with configuration Broker Configuration (clustered=false,journalDirectory=C:\Users\USR~1.JAR\AppData\Local\Temp\artemis-data/journal,bindingsDirectory=data/bindings,largeMessagesDirectory=data/largemessages,pagingDirectory=data/paging)
...
2023-01-23T11:41:19.058+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221007: Server is now live
2023-01-23T11:41:19.059+01:00 INFO 35336 --- [ restartedMain] o.apache.activemq.artemis.core.server : AMQ221001: Apache ActiveMQ Artemis Message Broker version 2.26.0 [localhost, nodeID=78075d71-9b0a-11ed-8116-3cf011ac7196]
In this second module, where "message" is being imported as a dependency, I'm sending and receiving some messages, if that matters.

Getting “Method Not Allowed” error when POST /actuator/bus-refresh for Spring Cloud Config server when service deployed in Google Cloud

I'm using Spring Cloud Config Server to get the configuration from Git and I've deployed my service in google cloud.
When I run the service in my local and invoke POST http://localhost:8887/actuator/bus-refresh, it runs successfully.
But when I invoke the same for the service deployed in Google Cloud, it gives - Request method POST not supported,
{
"timestamp": "2020-05-31T13:42:56.641+0000",
"status": 405,
"error": "Method Not Allowed",
"message": "Request method 'POST' not supported",
"path": "/actuator/bus-refresh"
}
Steps I followed:
Installed Rabbit MQ in google cloud, exposes it as service.
Updated the Spring Cloud Config - with rabbit mq server details
Build and pushed docker image to GC
Deployed and exposes Config server in GC
When hitting POST for http://<exyternalip>:8887/actuator/bus-refresh getting Request method 'POST' not supported.
When hitting GET for http://<exyternalip>:8887/actuator/bus-refresh - response gives me the application.properties in git
From local by pointing to GC rabbit mq with POST, it gives success.
Below is the configuration in my Config server
spring.application.name=my-config-server
server.port=8887
spring.cloud.config.server.git.skip-ssl-validation = true
management.endpoints.web.exposure.include=bus-refresh
spring.cloud.bus.enabled=true
spring.cloud.config.server.git.uri=****
spring.cloud.config.server.git.username=****
spring.cloud.config.server.git.password=****
spring.rabbitmq.host=34.68.237.224 #GC rabbit MQ
spring.rabbitmq.port=5672
spring.rabbitmq.username=rabbit
spring.rabbitmq.password=rabbit
what am I doing wrong?
I used the following dependency :
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-bus-amqp</artifactId>
instead of this :
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-amqp</artifactId>

Sending SpringBoot / Sleuth Zipkin Traces to Honeycomb.io

Sending traces from an existing instrumented Spring Boot application to honeycomb-opentracing-proxy is failing with the following error in the proxy console:
time="2019-10-25T02:51:55Z" level=info msg="error unmarshaling spans" error="json: cannot unmarshal bool into Go struct field binaryAnnotation.value of type string" type=application/json
Spring Boot Version: 2.1.3.RELEASE
Spring Cloud Sleuth Version: 2.1.1.RELEASE
Running the open tracing proxy with the following docker command:
docker run -p 9411:9411 honeycombio/honeycomb-opentracing-proxy -k $KEY -d $DATA_SET
From reading the documentation here the honeycomb-opentracing-proxy only supports v1 of the JSON API so I have explicitly set that in spring cloud config as this appears to default to v2.
application.properties
spring.zipkin.sender.type=web
spring.zipkin.base-url=http://localhost:9411
spring.zipkin.enabled=true
spring.zipkin.encoder=json_v1
Any help would be greatly appreciated
probably best to have the issue you raised in github vs cross posting. it is a bug https://github.com/honeycombio/honeycomb-opentracing-proxy/issues/37

Seeing difference when run jmx from Java application and GUI mode

My Java pom.xml has these dependencies:
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_core</artifactId>
<version>5.0</version>
</dependency>
and in my jmx file -> jsr223 assertion I have this simple function:
log.info(prev.getResponseDataAsString())
When I run from GUI mode I am able to see the complete response logged in the console, but when my Java application executes the same jmx, I got:
2018/10/25 20:50:53,576 12050 [INFO ] [Thread Group 1-1] (?:?) –
${__FileToString(${inputFilePath},,)}
Is this because I miss some dependencies in my pom.xml? Since it always return
${__FileToString(${inputFilePath},,)}
instead of the actual response which cause I am not able to continue the rest of the test. Rest of stuff all depends on this result. This function comes from the body data of the HTTP Request sampler!!!!!! If I give actual body there then I am able to run the jmx...... Any idea how to deal with this dynamic body data?
UPDATE 1
I found the solution! Instead directly use the ${__FileToString(${inputFilePath},,)} in the body data of HTTP Request Sampler, I can just create one more JSR223 Sampler above the HTTP Request Sampler and in this sampler, I can just do:
import org.apache.commons.io.FileUtils
log.info("--------------------------------------- "+ '${inputFilePath}')
String content = FileUtils.readFileToString(new File('${inputFilePath}'))
vars.put("reqBody", content)
and in the body data of HTTP Request Sampler, I will do ${reqBody}. That's it!
You were missing dependency :
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_functions</artifactId>
<version>5.0</version>
</dependency>

DataValidationException when I create actuator endpoints

I have created Actuator endpoints in endpoints.yml file
info:
'#name#':
version: '#version#'
buildNumber: '#buildNumber#'
buildDate: '#buildDate#'
buildBranch: '#buildBranch#'
When I try to execute I am getting a weird error:
{"errorType":"NOT_FOUND","entity":null,"message":"No message available","fieldErrors":null}
In the console it says
c.c.c.errors.BaseControllerAdvice - An unhandled exception was thrown, returning 500
org.springframework.data.rest.webmvc.ResourceNotFoundException: Resource not found!
Expected output looks like
{"${spring":{"application":{"name}":{"version":"#version#","buildNumber":"#buildNumber#","buildDate":"#buildDate#","buildBranch":"#buildBranch#"}}}}
What might be causing this Error?
I have added Dependency in order to enable the actuator points in order to know the info , health of the project the dependency which you need to add is
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId></dependency>

Resources