Spring boot 2 micormeter to statsd prefix not appending to the metrics - graphite

I've migrated spring boot 1.x to spring boot 2 with micrometer for metrics. After which could see the metrics in graphite via statsd. But, i can't see it with the prefix
After that i tried for basic prototype by following Configure micrometer-registry-statsd in spring boot 2. But, can't see metrics with prefix. It is showing from the registry name only
config:
management:
health:
defaults:
enabled: true
metrics:
enable:
example:
remote: true
export:
atlas:
enabled: false
statsd:
enabled: true
host: xx.xxx.xx.xx
port: xxxx
flavour: xxxx
step: 10s
**prefix: abc.xy**
security:
enabled: false
when i tried to print the statsdConfig properties the prefix shows as default value "statsd". After which i set the prefix property in the code too. That too didn't help.
Please share details on how to append the statsd.prefix

Related

CodeMagic Automatic build is not triggered though it receives the webhook from github

Automatic build is not triggered though it receives the webhook from github. Any input would be helpful.
codemagic.yml snippet
ionic-capacitor-android-app-qa:
name: tulip-fp
environment:
node: latest
triggering:
events:
- tag
branch_patterns:
- pattern: β€œuat”
include: true
source: true
tag_patterns:
- pattern: β€œ*”
include: true
....
Recent deliveries:
I have worked with #codemagic and here is the solutions -
Change "uat" to 'uat'. Basically use single quote in the pattern
Also make sure in the WebHook configuration in GitHub, "push" trigger is checked.
ionic-capacitor-android-app-qa:
name: tulip-fp
environment:
node: latest
triggering:
events:
- tag
- push
branch_patterns:
- pattern: 'uat'
include: true
source: true
tag_patterns:
- pattern: '*'
include: true

How to set Monolog log level per channel in Symfony

I'm using Symfony with Monolog to log data to loggly.com. My symfony app uses following configuration:
loggly:
type: loggly
token: ...
level: INFO
bubble: true
channels: ["app", "request"]
As you can see, I'm logging the channels app and request. The minimum log level is INFO for both channels.
Now i would like to distinguish the log level per channel like this:
Channel "app": INFO (and above)
Channel "request": ERROR (and above)
Is there a way to adjust my configuration or do I have to solve this programatically?
Thanks in advance
ninsky
loggly_app:
type: loggly
token: ...
level: INFO
bubble: true
channels: ["app"]
loggly_request:
type: loggly
token: ...
level: ERROR
bubble: true
channels: ["request"]
an additional option would be to have environment specific configs (e.g. when app-info logging wouldn't be required in production).

Sqlite file db for codeception testing fails

Attempts to use a sqlite file database in the app/cache/tests directory fail. This is determined by clearing the dev MySQl database and populating the test environment database via the console. Test database being populated was confirmed by an external Sqlite Manager. [Tests performed without the sqlite configuration pass.]
codeception.yml:
actor: Tester
paths:
tests: tests
log: tests/_output
data: tests/_data
support: tests/_support
envs: tests/_envs
settings:
bootstrap: _bootstrap.php
colors: false
memory_limit: 1024M
extensions:
enabled:
- Codeception\Extension\RunFailed
modules:
config:
- Db:
dsn: 'sqlite:./app/cache/test/test.sqlite'
user: ''
password: ''
dump: tests/_data/test.sql
populate: true
cleanup: false
reconnect: true
Edit:
In an Ubuntu VM, adding the Symfony2 configuration to acceptance.yml allows for partial success - the test uses the Sqlite db but does not rewrite from the specified dump (test.sql). In Windows adding the Symfony configuration makes no difference.
acceptance.yml:
class_name: AcceptanceTester
modules:
enabled:
- PhpBrowser:
url: http://vol
- \Helper\Acceptance
# adding these lines enables Ubuntu to use sqlite db
- Symfony2:
app_path: ./app
environment: test
You haven't enabled Db module in acceptance.yml
modules:
enabled:
- Db
- PhpBrowser:
url: http://vol
- \Helper\Acceptance
Also don't add PhpBrowser and Symfony2 at the same time,
only one can be used.

How can I test a page behind a security firewall in Symfony?

In Symfony's cookbook, there is a page entitled How to Simulate Authentication with a Token in a Functional Test. In it, it is said that:
The technique described in How to Simulate HTTP Authentication in a Functional Test is cleaner and therefore the preferred way.
Also, on the page that the quotation above links to, the documentation says:
The trick is to include the http_basic key in your firewall, along with the form_login key
This tells me that it is all right to have the form_login key, along with the http_basic key, and somehow http_basic should take precedence.
Here is my config_test.yml configuration file:
imports:
- { resource: config_dev.yml }
framework:
test: ~
session:
storage_id: session.storage.mock_file
profiler:
collect: false
web_profiler:
toolbar: false
intercept_redirects: false
swiftmailer:
disable_delivery: true
liip_functional_test:
cache_sqlite_db: true
doctrine:
dbal:
default_connection: default
connections:
default:
driver: pdo_sqlite
path: %kernel.cache_dir%/test.db
security:
firewalls:
default:
http_basic: ~
However, when I open my application in the test environment, I still get redirected to the login_form URL.
Why isn't setting the http_basic acting like the documentation says it should, namely it getting activated rather than form_login?
As commented here, having the code I pasted in my original question works just fine. The reason it is loading the login form is because I am not logging in via http_basic. In other words, when I have both form_login and http_basic enabled, I can login both by providing the PHP_AUTH_USER/PHP_AUTH_PASSWORD, and by logging in through the form. In effect, I don't need different security_*.yml files; I just need to add http_basic: ~ to the already-defined firewall.
Just split security.yml to security_test.yml and security_prod.yml.
In security_test.yml put default security configuration (as delivered with Symfony) or other one, which doesn't have firewall restrictions.
Create a specific config file for test environment, like config_test.yml with
imports:
- { resource: config.yml }
- { resource: security_test.yml }
note here config.yml itself doesn't have any security imports, because You will receive some Exception about overriding security directive or smth.
Create a separate config_prod.yml with
imports:
- { resource: config.yml }
- { resource: security_prod.yml }
Now You have separate security for test and prod environments.
If Your environment naming is good, then Kernel will pick config_test.yml only when tests are executed. For development environment Your should use config_dev.yml instead of config_test.yml

Sonata Page Bundle - creating a page

I'm trying to use Sonata Page Bundle and I've installed it without any issues but I'm having trouble adding blocks to pages. When I looked at Sonata Sandbox I can create page and when I click View Page it will generate blocks automatically which it doesn't do in my project.
I have basically copied settings from sonata sandbox. Also in sanbox if I'm logged in I can access the page without creating publication which in my project I'm getting an error route not found.
cmf_routing:
chain:
routers_by_id:
# enable the DynamicRouter with high priority to allow overwriting configured routes with content
#symfony_cmf_routing_extra.dynamic_router: 200
# enable the symfony default router with a lower priority
sonata.page.router: 150
router.default: 100
sonata_page:
multisite: host # host_with_path
use_streamed_response: false # set the value to false in debug mode or if the reverse proxy does not handle streamed response
ignore_route_patterns:
- (.*)admin(.*) # ignore admin route, ie route containing 'admin'
- ^_(.*) # ignore symfony routes
ignore_routes:
- sonata_page_cache_esi
- sonata_page_cache_ssi
- sonata_page_js_sync_cache
- sonata_page_js_async_cache
- sonata_cache_esi
- sonata_cache_ssi
- sonata_cache_js_async
- sonata_cache_js_sync
- sonata_cache_apc
ignore_uri_patterns:
- admin(.*) # ignore admin route, ie route containing 'admin'
cache_invalidation:
service: sonata.page.cache.invalidation.simple
recorder: sonata.page.cache.recorder
classes:
"Application\Sonata\PageBundle\Entity\Block": getId
default_template: default
templates:
default: { path: 'SonataPageBundle::layout.html.twig', name: 'default' }
2col: { path: 'SonataPageBundle::2columns_layout.html.twig', name: '2 column' }
page_defaults:
homepage: {decorate: false, enabled: true}
#caches:
# esi:
# token: add an unique token here # default is a random value
# version: 3 # version 3 is the default on debian wheezy ...
# servers:
# # you need to ajust this configuration to match your varnish configuration
# - %sonata_page.varnish.command%
# ssi:
# token: add an unique token here # default is a random value
catch_exceptions:
not_found: [404] # render 404 page with "not_found" key (name generated: _page_internal_error_{key})
fatal: [500] # so you can use the same page for different http errors or specify specific page for each error
# Enable Doctrine to map the provided entities
doctrine:
orm:
entity_managers:
default:
mappings:
ApplicationSonataPageBundle: ~
SonataPageBundle: ~
Thanks for any advice
1 - You are right, from front-end site, being logged-in, creating page and then clicking on View Page will generate blocks automatically. This is awesome, but unfortunately the feature will be deleted in futur versions (explanations included)
To use it for now, read the Full configuration options
sonata_page:
(...)
is_inline_edition_on: true
2 - No idea. To perform a global publication, just in case:
php app/console sonata:page:update-core-routes --site=all
php app/console sonata:page:create-snapshots --site=all

Resources