I've added the JVM Monitoring plugin as described here
That's all working great and I can, but now I'd like to add more JMX metrics. e.g. MemoryPool specific counters
So I've added this config to /opt/stackdriver/collectd/etc/collectd.d/jvm-sun-hotspot.conf
<MBean "jvm_localhost_MemoryPool">
ObjectName "java.lang:type=MemoryPool,name=*"
InstanceFrom "name"
<Value>
Type "gauge"
InstancePrefix "memorypool-usage_used"
Table false
Attribute "Usage.used"
</Value>
</MBean>
and
Collect "jvm_localhost_MemoryPool"
in the Connection section
It seems to be valid collectd config but when it's getting sent to Stackdriver/Google Cloud Monitoring it is rejected.
012 {#012 "index": 261,#012 "valueErrors": [#012 {#012 "error": {#012 "code": 3,#012 "message": "Unsupported
collectd id: plugin: \"jvm\" type: \"gauge\" type_instance: \"memorypool-usagecommitted\""#012 }#012 }#012 ]#012 },#012 {#012
"index": 262,#012 "valueErrors": [#012 {#012 "error": {#012 "code": 3,#012 "message": "Unsupported collectd id: plug
in: \"jvm\" type: \"gauge\" type_instance: \"memorypool-usageinit\""#012 }#012 }#012 ]#012 },#012 {#012 "index": 263,#012
"valueErrors": [#012 {#012 "error": {#012 "code": 3,#012 "message": "Unsupported collectd id: plugin: \"jvm\" type: \"gau
ge\" type_instance: \"memorypool-usagemax\""#012 }#012 }#012 ]#012 },#012 {#012 "index": 264,#012 "valueErrors": [#012
{#012 "error": {#012 "code": 3,#012 "message": "Unsupported
Now from what I understand it needs to be added as a custom metric, but this document suggests it would be auto created.
And indeed when I look at the list of builtin jvm metrics I can't see how they map onto the existing ones in the collectd configuration.
e.g. how is os-open_fd_count mapped to os/open_files ?
It would be helpful to see the actual api request being sent by Google's custom collectd implementation but I can't see a way of increasing logging.
I can see from this post that it's probably custom metrics where I want to be looking but how do I do that in the collectd configuration?
I've tried
InstancePrefix "custom.googleapis.com/memorypool-usage"
but still no joy.
Has anyone done this before or can offer any suggestions on what I'm doing wrong?
To get this logging I needed to add stackdriver_metric_type metadata.
The complete chain is now
<Chain "GenericJMX_jvm">
<Rule "rewrite_custom_jmx">
<Match regex>
Plugin "^GenericJMX$"
PluginInstance "^jvm.*$"
TypeInstance "^memorypool-usage_used$"
</Match>
<Target "set">
MetaData "stackdriver_metric_type" "custom.googleapis.com/jvm/memorypool/usage_used"
MetaData "label:pool" "%{plugin_instance}"
</Target>
<Target "replace">
MetaData "label:pool" "jvm" ""
</Target>
</Rule>
<Rule "rewrite_genericjmx_to_jvm">
<Match regex>
Plugin "^GenericJMX$"
PluginInstance "^jvm.*$"
</Match>
<Target "replace">
PluginInstance "jvm" ""
</Target>
<Target "set">
Plugin "jvm"
</Target>
Target "return"
</Rule>
</Chain>
The plugin instance is the pool name (e.g. G1 Eden Space) which is why I copied it into the 'pool' label.
This did auto-create the metric in Stackdriver but I also used the following body to the projects.metricDescriptors.create method to add description and units.
{
"name": "projects/yourprojecthere/metricDescriptors/custom.googleapis.com/jvm/memorypool/usage_used",
"labels": [
{
"key": "pool",
"description": "Name of the JVM memory pool."
}
],
"metricKind": "GAUGE",
"valueType": "DOUBLE",
"unit": "By",
"description": "Current size in bytes of the memory pool.",
"type": "custom.googleapis.com/jvm/memorypool/usage_used",
"monitoredResourceTypes": [
"gce_instance"
]
}
The resulting graph in metric explorer looks like this
The troubleshooting documents [1] could be helpful to determine what points need to be transformed, as well as to ensure your transformations behave as expected.
[1] https://cloud.google.com/monitoring/agent/custom-metrics-agent#troubleshooting
Related
I'm trying to create a stack from a template using the Heat API. I'm using the API reference here as a guide. I have the following json in a file called single-server-template.json:
{
"stack_name": "api-test",
"template": {
"heat_template_version": "rocky",
"description": "Testing Heat API\n",
"resources": {
"server1": {
"type": "OS::Nova::Server",
"properties": {
"name": "Server1",
"image": "Ubuntu 22.04 (Jammy)",
"flavor": "alt.st1.small",
"key_name": "my_key",
"networks": "Internal"
}
}
}
}
}
I'm sending it with this: curl -X POST -H "X-Auth-Token:$OS_TOKEN" -d #single-server-template.json https://$OS_HOST_URL:8004/v1/$OS_PROJECT_ID/stacks
I've been at it for hours but no matter what I send I get a 400 error:
{"code": 400, "title": "Bad Request", "explanation": "The server could not comply with the request since it is either malformed or otherwise incorrect.", "error": {"type": "HTTPBadRequest", "traceback": null, "message": "The server could not comply with the request since it is either malformed or otherwise incorrect."}}
Things I've tried:
confirmed my environment vars are filled in correctly before sending
confirmed that the template itself is valid by spinning it up from the UI console
confirmed that other endpoints that require auth work as expected
screaming and/or crying
Can anyone confirm that what I've got is correct, or test it against your own openstack instance? The only other thing I can think of is that maybe my openstack provider has an issue with their API
I am trying (and failing) to port a Visual Studio [extension][1] to the latest version of Visual Studio.
The extension provides a set of Roslyn analyzers and code fixes as well as an options page to configure some aspects of the analyzers' operation.
A reduction of the problem can be demonstrated with the following steps:
Follow instructions [here][2] to create an analyzer
Follow instructions [here][3] to create an options page
Now try to combine the two into a single VSIX.
I have tried starting from #1 and then adding relevant items from #2 and vice versa. To no avail.
Unfortunately the two samples produce different project types, and target different .NET frameworks which doesn't simplify things.
Depending on which sample I start with either the analyzers or the options page are not loaded.
Here is what the .vsixmanifest looks like (started by using the options page sample and then adding in the analyzer code):
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="MyToolsOptionsExtension.208a3dc2-4dd7-40db-bb6c-ab135b5ddaca" Version="1.0" Language="en-US" Publisher="ME" />
<DisplayName>MyToolsOptionsExtension</DisplayName>
<Description xml:space="preserve">Empty VSIX Project.</Description>
</Metadata>
<Installation>
<InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[17.0, 18.0)">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
<Dependency Id="Microsoft.VisualStudio.MPF.16.0" DisplayName="Visual Studio MPF 16.0" d:Source="Installed" Version="[16.0,17.0)" />
</Dependencies>
<Prerequisites>
<Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[17.0,18.0)" DisplayName="Visual Studio core editor" />
<Prerequisite Id="Microsoft.VisualStudio.Component.Roslyn.LanguageServices" Version="[15.0,)" DisplayName="Roslyn Language Services" />
</Prerequisites>
<Assets>
<Asset Type="Microsoft.VisualStudio.VsPackage" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.MefComponent" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
<Asset Type="Microsoft.VisualStudio.Analyzer" d:Source="Project" d:ProjectName="%CurrentProject%" Path="|%CurrentProject%;PkgdefProjectOutputGroup|" />
</Assets>
</PackageManifest>
How can I debug why a specific asset defined in the .vsixmanifest file is not being loaded?
Would be great to see a sample where these are combined.
Peering into the compiled *.vsix (as zip file) it looks like an error in the auto-generation of the .pkgdef / catalog.json file, depending on what kind of project I start from. One or the other is missing from here despite having an identical vsixmanifest. For example catalog.json looks like this (note that the options page is missing):
"manifestVersion": "1.1",
"info": {
"id": "Analyzer1.2d1c1928-c190-4711-b986-1f7d0f3d8f5c,version=1.0",
"manifestType": "Extension"
},
"packages": [
{
"id": "Component.Analyzer1.2d1c1928-c190-4711-b986-1f7d0f3d8f5c",
"version": "1.0",
"type": "Component",
"extension": true,
"dependencies": {
"Analyzer1.2d1c1928-c190-4711-b986-1f7d0f3d8f5c": "1.0",
"Microsoft.VisualStudio.Component.CoreEditor": "15.0",
"Microsoft.VisualStudio.Component.Roslyn.LanguageServices": "15.0"
},
"localizedResources": [
{
"language": "en-US",
"title": "Analyzer1",
"description": "This is a sample diagnostic extension for the .NET Compiler Platform (\"Roslyn\")."
}
]
},
{
"id": "Analyzer1.2d1c1928-c190-4711-b986-1f7d0f3d8f5c",
"version": "1.0",
"type": "Vsix",
"payloads": [
{
"fileName": "Analyzer1.Vsix.vsix",
"size": 33906
}
],
"vsixId": "Analyzer1.2d1c1928-c190-4711-b986-1f7d0f3d8f5c",
"extensionDir": "[installdir]\\Common7\\IDE\\Extensions\\pv2xi53w.cfr",
"installSizes": {}
}
]
}```
[1]: https://marketplace.visualstudio.com/items?itemName=YoavFrandzel.CheckedExceptions
[2]: https://learn.microsoft.com/en-us/dotnet/csharp/roslyn-sdk/tutorials/how-to-write-csharp-analyzer-code-fix
[3]: https://learn.microsoft.com/en-us/visualstudio/extensibility/creating-an-options-page?view=vs-2022
I'm trying to deploy a larger rules files to Firestore. The rules file is currently at 55KB (well below Firestore's listed limit of 256KB). Every time I attempt to simply deploy the rules by themselves using this command...
firebase deploy --only firestore:rules --debug
I get this error...
Error: HTTP Error: 400, Request contains an invalid argument.
[2020-09-13T19:29:41.552Z] Error Context: {
"body": {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
},
"response": {
"statusCode": 400,
"body": {
"error": {
"code": 400,
"message": "Request contains an invalid argument.",
"status": "INVALID_ARGUMENT"
}
},
"headers": {
"vary": "X-Origin, Referer, Origin,Accept-Encoding",
"content-type": "application/json; charset=UTF-8",
"date": "Sun, 13 Sep 2020 19:29:41 GMT",
"server": "ESF",
"cache-control": "private",
"x-xss-protection": "0",
"x-frame-options": "SAMEORIGIN",
"x-content-type-options": "nosniff",
"alt-svc": "h3-29=\":443\"; ma=2592000,h3-27=\":443\"; ma=2592000,h3-T051=\":443\"; ma=2592000,h3-T050=\":443\"; ma=2592000,h3-Q050=\":443\"; ma=2592000,h3-Q046=\":443\"; ma=2592000,h3-Q043=\":443\"; ma=2592000,quic=\":443\"; ma=2592000; v=\"46,43\"",
"accept-ranges": "none",
"transfer-encoding": "chunked"
},
"request": {
"uri": {
"protocol": "https:",
"slashes": true,
"auth": null,
"host": "firebaserules.googleapis.com",
"port": 443,
"hostname": "firebaserules.googleapis.com",
"hash": null,
"search": null,
"query": null,
"pathname": "/v1/projects/brianneisler-test:test",
"path": "/v1/projects/brianneisler-test:test",
"href": "https://firebaserules.googleapis.com/v1/projects/brianneisler-test:test"
},
"method": "POST"
}
}
}
I ran through a test where i commented out all of the rules code and then slowly uncommented portions of it based on dependency (looking for a problematic line). However, what I noticed is that as I uncommented more and more code the problem started happening more frequently. At first it would fail 1 in 5 times. Uncomment more code, started failing more frequently. This leads me to believe that there is some kind of race condition based on compilation time on Firebase's side since the size of the file remained the same, only the code that was uncommented changed.
I have reached out to Firebase's support team and they have verified that there are no errors in the rules themselves. They have been able to reproduce the error but their suggestions of how to workaround the issue have not worked. Here's the response I received from their support team.
Thanks for the detailed information. I made some tests using the rules you shared, it seems that the rules have the correct syntax, but there are too many rules to update in the Firebase console at a time.
One option is uploading the rules in chunks. First, try uploading the first 1500 lines of the rules and publish the rules. After that add the rest code lines, it should be like 400, and publish the rules once again, it should not send the error this time.
I also tried deploying the rules using the Firebase CLI. When I tried to deploy the functions the first time it showed me the same error as you, but I tried to deploy the functions one more time and it did it correctly.
It's clear they're running into the same issue where this will occasionally fail.
Has anyone else run into this issue and figured out a way to work around it?
Current workaround
If i minimize the rules using the firemin rules minifier, the deployment succeeds more often. This makes sense since it collapses single use functions and overall reduces the size of the rules file.
I have a problem when I create timeseries on StackDriver.
So basically I create time series by executing the API from this site https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/create
and for the resource type I set it as `cloud_composer_environment'.
and the JSON looks like
"resource": {
"type": "cloud_composer_environment",
"labels": {
"project_id": "MY PROJECT ID",
"environment_name": "MY ENVIRONTMENT",
"location": "us-central1"
}
},
and when I execute the API, the result was
{
"error": {
"code": 400,
"message": "One or more TimeSeries could not be written: Metrics cannot be written to cloud_composer_environment.: timeSeries[0]",
"status": "INVALID_ARGUMENT"
}
}
and I dont know How to fix it, there is no information why was it a bad request
Composer stackdriver metrics are not publicly writable today and we are currently working on exposing more workflow-related metrics. Meanwhile, you may want to create your own metrics for reporting and/or use composer stackdriver logs for monitoring/alerting as described here.
I have run through the Google Prediction API tutorials and documentation for "hello prediction - https://cloud.google.com/prediction/docs/hello_world
However when training the model in the developer console my request fails with the following output:
Request:
POST https://www.googleapis.com/prediction/v1.6/projects/959568262740/trainedmodels?key={YOUR_API_KEY}
{
"id": "language_id",
"storageDataLocation": "http://storage.googleapis.com/2341234/language_id.txt"
}
Response:
400 OK
- Show headers -
{
"error": {
"errors": [
{
"domain": "global",
"reason": "invalid",
"message": "Training data file is empty.",
"locationType": "other",
"location": "id"
}
],
"code": 400,
"message": "Training data file is empty."
}
}
I've implemented Authorize requests using OAuth 2.0: - is there anything else that I should be doing, or that may have changed between Google PRediction API v 1.6 and the tutorial. Any link to any additional tutorial or article on the subject would also be extremely valuable so can debug myself!
Your storageDataLocation is not correct.
When you go to the Overview tab in Google Developers Console, you'll find your Project ID: xxxxx (example) and the bucket you've stored in is called yyyy (example).
Then replace the "storageDataLocation:" "xxxxx/yyyy". Should solve this problem. You need the relative path to Google Storage, and not the absolute web path.