Related
Here is my json file:
{
"id": "sub_1M3z4ZFuWMT5VbyLdhxe1SGB",
"object": "subscription",
"application": null,
"application_fee_percent": null,
"automatic_tax": {
"enabled": true
},
"billing_cycle_anchor": 1671096923,
"billing_thresholds": null,
"cancel_at": null,
"cancel_at_period_end": false,
"canceled_at": null,
"collection_method": "charge_automatically",
"created": 1668418523,
"currency": "eur",
"current_period_end": 1673775323,
"current_period_start": 1671096923,
"customer": "cus_MnaFTQN0THNHcw",
"days_until_due": null,
"default_payment_method": "pm_1M3z4WFuWMT5VbyLzq2CMtRb",
"default_source": null,
"default_tax_rates": [],
"description": null,
"discount": null,
"ended_at": null,
"items": {
"object": "list",
"data": [
{
"id": "si_MnaFGSZRM6lgJ5",
"object": "subscription_item",
"billing_thresholds": null,
"created": 1668418523,
"metadata": {},
"plan": {
"id": "price_1LN1ZwFuWMT5VbyLdOZ3X83u",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 1900,
"amount_decimal": "1900",
"billing_scheme": "per_unit",
"created": 1658180052,
"currency": "eur",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": null,
"product": "prod_M5BxCLyY8BJinB",
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"price": {
"id": "price_1LN1ZwFuWMT5VbyLdOZ3X83u",
"object": "price",
"active": true,
"billing_scheme": "per_unit",
"created": 1658180052,
"currency": "eur",
"custom_unit_amount": null,
"livemode": false,
"lookup_key": "mini",
"metadata": {},
"nickname": null,
"product": "prod_M5BxCLyY8BJinB",
"recurring": {
"aggregate_usage": null,
"interval": "month",
"interval_count": 1,
"trial_period_days": null,
"usage_type": "licensed"
},
"tax_behavior": "inclusive",
"tiers_mode": null,
"transform_quantity": null,
"type": "recurring",
"unit_amount": 1900,
"unit_amount_decimal": "1900"
},
"quantity": 1,
"subscription": "sub_1M3z4ZFuWMT5VbyLdhxe1SGB",
"tax_rates": []
}
],
"has_more": false,
"total_count": 1,
"url": "/v1/subscription_items?subscription=sub_1M3z4ZFuWMT5VbyLdhxe1SGB"
},
"latest_invoice": "in_1MFDqoFuWMT5VbyLT3EyrqPd",
"livemode": false,
"metadata": {},
"next_pending_invoice_item_invoice": null,
"on_behalf_of": null,
"pause_collection": null,
"payment_settings": {
"payment_method_options": null,
"payment_method_types": null,
"save_default_payment_method": "off"
},
"pending_invoice_item_interval": null,
"pending_setup_intent": null,
"pending_update": null,
"plan": {
"id": "price_1LN1ZwFuWMT5VbyLdOZ3X83u",
"object": "plan",
"active": true,
"aggregate_usage": null,
"amount": 1900,
"amount_decimal": "1900",
"billing_scheme": "per_unit",
"created": 1658180052,
"currency": "eur",
"interval": "month",
"interval_count": 1,
"livemode": false,
"metadata": {},
"nickname": null,
"product": "prod_M5BxCLyY8BJinB",
"tiers_mode": null,
"transform_usage": null,
"trial_period_days": null,
"usage_type": "licensed"
},
"quantity": 1,
-
"trial_end": 1671096923,
"trial_start": 1668418523
}
It's the subscription object from Stripe.
I want to create a class called SubscriptionDetails that has an amount field (in the datas plan object)
I've done that, but with my tests, I see that amount equals 0, I don't know why:
here is my class:
#Data
#JsonIgnoreProperties(ignoreUnknown = true)
public class SubscriptionDetails implements Serializable {
#JsonProperty("plan")
private Plan plan;
#Data
#JsonIgnoreProperties(ignoreUnknown = true)
public class Plan {
#JsonProperty("amount")
private int amount;
}
}
Can you help me please ?
I also tried to do this:
#Data
#JsonIgnoreProperties(ignoreUnknown = true)
public class SubscriptionDetails implements Serializable {
#JsonProperty("plan")
private Plan plan;
}
with Plan object from stripe but it doesn't work.
Here is what i want to test:
#Test
public void testRetrieveSubscriptionDetails_ok()
throws IOException, URISyntaxException, StripeClientException, BadRequestException {
String body = FileUtils.readFileToString(ResourceUtils.getFile("classpath:json/subscriptions-200.json"),
StandardCharsets.UTF_8);
mockServer
.expect(ExpectedCount.once(),
requestTo(new URI("http://localhost:80/v1/subscriptions/sub_1M3z4ZFuWMT5VbyLdhxe1SGB")))
.andExpect(header("Accept", "application/json, application/*+json"))
.andExpect(header("Authorization", "Bearer test")).andExpect(header("Content-Length", "0"))
.andExpect(method(HttpMethod.GET))
.andRespond(withStatus(HttpStatus.OK).contentType(MediaType.APPLICATION_JSON).body(body));
SubscriptionDetails subscriptionDetails = this.stripeClient
.retrieveSubscriptionDetails("sub_1M3z4ZFuWMT5VbyLdhxe1SGB");
mockServer.verify();
Assertions.assertThat(subscriptionDetails).isNotNull();
Assertions.assertThat(subscriptionDetails.getTrialEnd()).isEqualTo(1671096923L);
Assertions.assertThat(subscriptionDetails.getAmount()).isEqualTo(19.00);
I am making weather forecast app using Android Studio, Java and OpenWeatherAPI. I got stuck on a problem and can't find solution. It is a JSON response I get from API:
{
"cod": "200",
"message": 0,
"cnt": 40,
"list": [
{
"dt": 1672812000,
"main": {
"temp": 277.75,
"feels_like": 273.5,
"temp_min": 277.75,
"temp_max": 279.26,
"pressure": 1014,
"sea_level": 1014,
"grnd_level": 1015,
"humidity": 85,
"temp_kf": -1.51
},
"weather": [
{
"id": 802,
"main": "Clouds",
"description": "scattered clouds",
"icon": "03n"
}
],
"clouds": {
"all": 29
},
"wind": {
"speed": 6.1,
"deg": 197,
"gust": 15.31
},
"visibility": 10000,
"pop": 0,
"sys": {
"pod": "n"
},
"dt_txt": "2023-01-04 06:00:00"
},
{
"dt": 1672844400,
"main": {
"temp": 282.13,
"feels_like": 278.47,
"temp_min": 282.13,
"temp_max": 282.13,
"pressure": 1012,
"sea_level": 1012,
"grnd_level": 1007,
"humidity": 84,
"temp_kf": 0
},
"weather": [
{
"id": 500,
"main": "Rain",
"description": "light rain",
"icon": "10d"
}
],
"clouds": {
"all": 100
},
"wind": {
"speed": 8.08,
"deg": 234,
"gust": 18.26
},
"visibility": 10000,
"pop": 1,
"rain": {
"3h": 2.84
},
"sys": {
"pod": "d"
},
"dt_txt": "2023-01-04 15:00:00"
},
{
"dt": 1673233200,
"main": {
"temp": 280.69,
"feels_like": 277.6,
"temp_min": 280.69,
"temp_max": 280.69,
"pressure": 998,
"sea_level": 998,
"grnd_level": 993,
"humidity": 72,
"temp_kf": 0
},
"weather": [
{
"id": 804,
"main": "Clouds",
"description": "overcast clouds",
"icon": "04n"
}
],
"clouds": {
"all": 88
},
"wind": {
"speed": 5.14,
"deg": 207,
"gust": 12.85
},
"visibility": 10000,
"pop": 0,
"sys": {
"pod": "n"
},
"dt_txt": "2023-01-09 03:00:00"
}
],
"city": {
"id": 2950159,
"name": "Berlin",
"coord": {
"lat": 52.5244,
"lon": 13.4105
},
"country": "DE",
"population": 1000000,
"timezone": 3600,
"sunrise": 1672816596,
"sunset": 1672844715
}
}
And my question is: Is there a way to extract all keys for example "weather"
"weather": [
{
"id": 804,
"main": "Clouds",
"description": "overcast clouds",
"icon": "04n"
}
],
into and array (of JSONObjects?) so the information can be accessed like this or in similiar fashion:
weather_arrray[i].getString("description")
I have been searching online for solution using libraries like Gson or Jackson but I didn't find any clues how to get it done. I am opened to any other ideas if putting it in arrays is not correct approach. I just need to be able to easily access info from for example 1st, 4th or 27th etc. "weather" or lets say "main" occurence.
you can do this using dynamic JSON Parsor.
If your response contains JSONObject, then store it as a JSONObject, OR if your response contains JSONArray, then store it as a JSONArray.
Pass your response as an argument inside below function, and check that.
Here Iterator is used to fetch dynamic key names from JSONObject.
private void parseJson(JSONObject data) {
if (data != null) {
Iterator<String> it = data.keys();
while (it.hasNext()) {
String key = it.next();
try {
if (data.get(key) instanceof JSONArray) {
JSONArray arry = data.getJSONArray(key);
int size = arry.length();
for (int i = 0; i < size; i++) {
parseJson(arry.getJSONObject(i));
}
} else if (data.get(key) instanceof JSONObject) {
parseJson(data.getJSONObject(key));
} else {
System.out.println(key + ":" + data.getString(key));
}
} catch (Throwable e) {
try {
System.out.println(key + ":" + data.getString(key));
} catch (Exception ee) {
}
e.printStackTrace();
}
}
}
}
How to map JSON object with POJO class in Spring Boot. I have JSON data as below:
{
"report": "Cost History",
"dimensions": [
{
"time": [
{
"label": "Total",
"name": "total"
},
{
"name": "2021-12",
"label": "2021-12",
"direct": null,
"populated": false,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": -1
},
{
"name": "2022-12",
"label": "2022-12",
"direct": null,
"populated": true,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": -1
}
// etc... etc ....
]
},
{
"Azure-Services": [
{
"label": "Total",
"name": "total"
},
{
"name": "3000",
"label": "Storage",
"direct": null,
"populated": null,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": -1
},
{
"name": "3001",
"label": "Storage Account",
"direct": true,
"populated": null,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": 0
}
// .. etc etc
]
}
],
"measures": [
{
"name": "total_cost",
"label": "Total Cost ($)",
"metadata": {
"type": "cost",
"units": "CAD",
"supports_drilldown": true,
"label": "Total Cost ($)"
}
}
],
"interval": "monthly",
"filters": [
"Azure-Services:select:4001,4012"
],
"updated_at": "2022-12-10T06:17:08Z",
"bill_drop_info": [],
"visualization_options": null,
"data": [
[
[
8421.915094617003
],
[
null
],
[
null
],
[
null
]
],
[
[
null
],
[
null
],
[
null
],
[
null
]
],
[
[
null
],
[
null
],
[
null
],
[
null
]
],
[
[
388.6801747227753
],
[
388.6801747227753
],
[
0.5626267227750004
],
[
388.1175480000003
]
],
[
[
872.0477601498656
],
[
872.0477601498656
],
[
1.2152157498662994
],
[
870.8325443999993
]
]
],
"status": "ok",
"enable_dp_popover": false,
"cube_id": "44326_0419_03"
}
and I am getting response from my REST Api like this:
{
"responseMessage": "SUCCESS",
"status": "OK",
"statusCode": 1,
"response": {
"report": "Cost History",
"dimensions": [
{
"time": [
{
"label": "Total",
"name": "total",
"direct": null,
"populated": false,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": 0
},
{
"label": "2021-12",
"name": "2021-12",
"direct": null,
"populated": false,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": -1
},
{
"label": "2022-12",
"name": "2022-12",
"direct": null,
"populated": true,
"excluded": null,
"extended": false,
"sort_order": null,
"parent": -1
}
],
"Azure-Services": []
},
{
"time": [],
"Azure-Services": [
{
"parent": 0,
"label": "Total",
"name": "total",
"direct": false,
"populated": null,
"excluded": null,
"extended": false,
"sort_order": null
},
{
"parent": -1,
"label": "Storage",
"name": "3000",
"direct": false,
"populated": null,
"excluded": null,
"extended": false,
"sort_order": null
},
{
"parent": 0,
"label": "Storage Account",
"name": "3001",
"direct": true,
"populated": null,
"excluded": null,
"extended": false,
"sort_order": null
}
]
}
],
"measures": [
{
"name": "total_cost",
"label": "Total Cost ($)",
"metadata": {
"type": "cost",
"units": "CAD",
"label": "Total Cost ($)",
"supports_drilldown": true
}
}
],
"interval": "monthly",
"filters": [
"Azure-Services:select:4001,4012"
],
"data": [
[
[
8486.168096050156
],
[
8486.168096050156
],
[
9.860766100157399
],
[
8476.30732995
]
],
[
[
null
],
[
null
],
[
null
],
[
null
]
],
[
[
388.6801747227753
],
[
388.6801747227753
],
[
0.5626267227750004
],
[
388.1175480000003
]
],
[
[
872.0477601498656
],
[
872.0477601498656
],
[
1.2152157498662994
],
[
870.8325443999993
],
]
],
"status": "ok",
"updated_at": "2022-12-12T06:38:27Z",
"bill_drop_info": [],
"visualization_options": null,
"enable_dp_popover": false,
"cube_id": "44326_0419_03"
}
}
This is AzureService.java POJO class:
public class AzureService {
#JsonProperty("label")
private String label;
#JsonProperty("name")
private String name;
#JsonProperty("direct")
private boolean direct;
#JsonProperty("populated")
private Object populated;
#JsonProperty("excluded")
private Object excluded;
#JsonProperty("extended")
private boolean extended;
#JsonProperty("sort_order")
private Object sortOrder;
private long parent;
}
This is Time.java POJO class:
public class Time {
#JsonProperty("label")
private String timeLabel;
#JsonProperty("name")
private String timeName;
#JsonProperty("direct")
private Object timeDirect;
#JsonProperty("populated")
private boolean timePopulated;
#JsonProperty("excluded")
private Object timeExcluded;
#JsonProperty("extended")
private boolean timeExtended;
#JsonProperty("sort_order")
private Object timeSortOrder;
#JsonProperty("parent")
private long timeParent;
}
Below is my Dimension.java POJO class:
#Getter
#Setter
public class Dimension {
#JsonProperty("time")
private List<Time> time = new ArrayList<Time>();
#JsonProperty("Azure-Services")
private List<AzureService> azureServices = new ArrayList<AzureService>();
}
This is my CustomReport.java POJO:
#Getter
#Setter
public class CustomReport{
private String report;
private List<Dimension> dimensions = new ArrayList<Dimension>();
private List<Measure> measures = new ArrayList<Measure>();
private String interval;
private List<String> filters = new ArrayList<String>();
#JsonProperty("updated_at")
private String updatedAt;
#JsonProperty("bill_drop_info")
private List<Object> billDropInfo = new ArrayList<Object>();
#JsonProperty("visualization_options")
private Object visualizationOptions;
private List<List<List<Double>>> data = new ArrayList<List<List<Double>>>();
private String status;
#JsonProperty("enable_dp_popover")
private boolean enableDpPopover;
#JsonProperty("cube_id")
private String cubeId;
}
These two classes have properties. I am unable to figure out why these two object showing each others JSON Object response. So is there any JSON property or anything that I need to write before mapping JSON object to POJO?
I am returning Response in my controller using Springboot. I am throwing an Exception in my service class and returning a particular response code when the exception is caught. However, when ever I hit the endpoint on Postman I still gett 200 ok even if an exception was caught.
Here is the service
public Response signup(RegisterDto register) throws CrossPointException{
try{
if (!register.getEmail().matches(EMAIL_PATTERN)){
throw new CrossPointException("Email is invalid");
}
if(!register.getPhoneNumber().matches(PHONE_NUMBER_PATTERN)){
throw new CrossPointException("Phone number is invalid");
}
Optional<User> foundUser = userRepository.findByUsername(register.getEmail());
if(foundUser.isPresent()){
throw new CrossPointException("Email already exist");
}
User user = new User();
user.setFirstName(register.getFirstName());
user.setLastName(register.getLastName());
user.setPhoneNumber(register.getPhoneNumber());
user.setEmail(register.getEmail());
user.setPassword(passwordEncoder.encode(register.getPassword()));
user.setUsername(register.getEmail());
user.setCreatedAt(new Date());
user.setEnabled(false);
user.setRole(Types.Role.BUSINESS);
user.setRcNumber(register.getRcNumber());
user.setUserType(register.getUserType());
user.setRole(Types.Role.INDIVIDUAL);
user.setPartnerName(register.getPartnerName());
user.setBusinessRegistered(register.isBusinessRegistered());
user.setGender(register.getGender());
User savedUser = userRepository.save(user);
basketService.createBasket(savedUser.getId());
GenerateOtpResponseDto response = otpService.generateOtp();
mailService.sendMail(new NotificationEmail("Please Activate your account",
user.getEmail(), "this is your verification cade " + response.getOtp()));
return Response.status(200, "testing this out").entity(BaseResponse.builder().status(true).
responseCode(HttpStatus.OK.toString()).message("Thanks for signing up. Kindly check your " +
"email to activate your account").data(user).build()).build();
}catch (CrossPointException ex){
return Response.status(400, HttpStatus.BAD_REQUEST.toString()).entity(
BaseResponse.builder()
.responseCode(HttpStatus.BAD_REQUEST.toString())
.status(false)
.message(ex.getMessage())
.build()
).build();
}
}
This is what my custom BaseResponse looks like
public class BaseResponse<T> {
private boolean status;
private String message;
private String responseCode;
#JsonInclude(JsonInclude.Include.NON_NULL)
private T data;
}
When I hit the endpoint I am getting a number of things that are needless as part of the response.
{
"context": {
"headers": {},
"configuration": null,
"entity": {
"context": {
"headers": {},
"configuration": null,
"entity": {
"status": false,
"message": "Email already exist",
"responseCode": "400 BAD_REQUEST"
},
"entityType": "com.crosspoint.crosspointfinance.data.model.BaseResponse",
"entityAnnotations": [],
"entityStream": {
"committed": false,
"closed": false
},
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"committed": false,
"date": null,
"lastModified": null,
"allowedMethods": [],
"acceptableMediaTypes": [
{
"type": "*",
"subtype": "*",
"parameters": {},
"quality": 1000,
"wildcardType": true,
"wildcardSubtype": true
}
],
"links": [],
"entityTag": null,
"stringHeaders": {},
"entityClass": "com.crosspoint.crosspointfinance.data.model.BaseResponse",
"responseCookies": {},
"acceptableLanguages": [
"*"
],
"requestCookies": {},
"lengthLong": -1
},
"status": 400,
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"cookies": {},
"metadata": {},
"date": null,
"lastModified": null,
"allowedMethods": [],
"entity": {
"status": false,
"message": "Email already exist",
"responseCode": "400 BAD_REQUEST"
},
"statusInfo": {
"reasonPhrase": "400 BAD_REQUEST",
"statusCode": 400,
"family": "CLIENT_ERROR"
},
"links": [],
"entityTag": null,
"stringHeaders": {},
"headers": {}
},
"entityType": "org.glassfish.jersey.message.internal.OutboundJaxrsResponse",
"entityAnnotations": [],
"entityStream": {
"committed": false,
"closed": false
},
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"committed": false,
"date": null,
"lastModified": null,
"allowedMethods": [],
"acceptableMediaTypes": [
{
"type": "*",
"subtype": "*",
"parameters": {},
"quality": 1000,
"wildcardType": true,
"wildcardSubtype": true
}
],
"links": [],
"entityTag": null,
"stringHeaders": {},
"entityClass": "org.glassfish.jersey.message.internal.OutboundJaxrsResponse",
"responseCookies": {},
"acceptableLanguages": [
"*"
],
"requestCookies": {},
"lengthLong": -1
},
"status": 200,
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"cookies": {},
"metadata": {},
"date": null,
"lastModified": null,
"allowedMethods": [],
"entity": {
"context": {
"headers": {},
"configuration": null,
"entity": {
"status": false,
"message": "Email already exist",
"responseCode": "400 BAD_REQUEST"
},
"entityType": "com.crosspoint.crosspointfinance.data.model.BaseResponse",
"entityAnnotations": [],
"entityStream": {
"committed": false,
"closed": false
},
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"committed": false,
"date": null,
"lastModified": null,
"allowedMethods": [],
"acceptableMediaTypes": [
{
"type": "*",
"subtype": "*",
"parameters": {},
"quality": 1000,
"wildcardType": true,
"wildcardSubtype": true
}
],
"links": [],
"entityTag": null,
"stringHeaders": {},
"entityClass": "com.crosspoint.crosspointfinance.data.model.BaseResponse",
"responseCookies": {},
"acceptableLanguages": [
"*"
],
"requestCookies": {},
"lengthLong": -1
},
"status": 400,
"length": -1,
"language": null,
"location": null,
"mediaType": null,
"cookies": {},
"metadata": {},
"date": null,
"lastModified": null,
"allowedMethods": [],
"entity": {
"status": false,
"message": "Email already exist",
"responseCode": "400 BAD_REQUEST"
},
"statusInfo": {
"reasonPhrase": "400 BAD_REQUEST",
"statusCode": 400,
"family": "CLIENT_ERROR"
},
"links": [],
"entityTag": null,
"stringHeaders": {},
"headers": {}
},
"statusInfo": "OK",
"links": [],
"entityTag": null,
"stringHeaders": {},
"headers": {}
}
This is response is too lengthy and contains a lot of useless info.
All I want is something like this:
{
"status": true,
"message": "Successfully Joined wait-list",
"responseCode": "200 OK",
"data": {
"id": "6349a3be93a8523e3f40ee00",
"email": "ojoi#gmail.com",
"firstName": "Ojo"
}
}
This is what my controller looks like
#PostMapping("/signup")
#PermitAll
public Response signUp(#RequestBody RegisterDto register) throws CrossPointException{
return Response.ok(auth.signup(register)).build();
}
As you can see bellow my restart police is set to "always", but almost every night I get an out of memory (expected and not the issue I'm trying to solve here) and in the morning the container is stopped.
If we check the RestartCount property it says 2, does this mean that it restarted twice and then stopped? Is it possible that it failed during the start process for some reason and stopped trying?
Everything works fine when I start it again manually.
Here is the docker inspect result, let me know if you have a clue on what's happening.
{
"Id": "...",
"Created": "2020-11-26T16:32:57.611591274Z",
"Path": "/bin/sh",
"Args": [
"-c",
"/entrypoint.sh $profile $service_name"
],
"State": {
"Status": "exited",
"Running": false,
"Paused": false,
"Restarting": false,
"OOMKilled": false,
"Dead": false,
"Pid": 0,
"ExitCode": 137,
"Error": "OCI runtime create failed: container_linux.go:349: starting container process caused \"process_linux.go:449: container init caused \\\"process_linux.go:432: running prestart hook 0 caused \\\\\\\"error running hook: exit status 2, stdout: , stderr: fatal error: runtime: out of memory\\\\\\\\n\\\\\\\\nruntime stack:\\\\\\\\nruntime.throw(0x5630cae5b359, 0x16)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/panic.go:774 +0x74 fp=0x7ffffee76988 sp=0x7ffffee76958 pc=0x5630c9507714\\\\\\\\nruntime.sysMap(0xc000000000, 0x4000000, 0x5630cd2a71f8)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mem_linux.go:169 +0xc7 fp=0x7ffffee769c8 sp=0x7ffffee76988 pc=0x5630c94f0457\\\\\\\\nruntime.(*mheap).sysAlloc(0x5630cd28aa40, 0x2000, 0x0, 0x0)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/malloc.go:701 +0x1cf fp=0x7ffffee76a70 sp=0x7ffffee769c8 pc=0x5630c94e33ff\\\\\\\\nruntime.(*mheap).grow(0x5630cd28aa40, 0x1, 0xffffffff)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mheap.go:1255 +0xa5 fp=0x7ffffee76ac0 sp=0x7ffffee76a70 pc=0x5630c94fe605\\\\\\\\nruntime.(*mheap).allocSpanLocked(0x5630cd28aa40, 0x1, 0x5630cd2a7208, 0x1)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mheap.go:1170 +0x268 fp=0x7ffffee76b40 sp=0x7ffffee76ac0 pc=0x5630c94fe498\\\\\\\\nruntime.(*mheap).alloc_m(0x5630cd28aa40, 0x1, 0x5630c953002a, 0x0)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mheap.go:1022 +0xc6 fp=0x7ffffee76b90 sp=0x7ffffee76b40 pc=0x5630c94fdd36\\\\\\\\nruntime.(*mheap).alloc.func1()\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mheap.go:1093 +0x4e fp=0x7ffffee76bc8 sp=0x7ffffee76b90 pc=0x5630c95339de\\\\\\\\nruntime.(*mheap).alloc(0x5630cd28aa40, 0x1, 0x1002a, 0x40000)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mheap.go:1092 +0x8c fp=0x7ffffee76c18 sp=0x7ffffee76bc8 pc=0x5630c94fe01c\\\\\\\\nruntime.(*mcentral).grow(0x5630cd28b878, 0x0)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mcentral.go:255 +0x7d fp=0x7ffffee76c58 sp=0x7ffffee76c18 pc=0x5630c94efe7d\\\\\\\\nruntime.(*mcentral).cacheSpan(0x5630cd28b878, 0x7f7e1619e000)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mcentral.go:106 +0x300 fp=0x7ffffee76cb8 sp=0x7ffffee76c58 pc=0x5630c94ef9a0\\\\\\\\nruntime.(*mcache).refill(0x7f7e1619e008, 0x2a)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/mcache.go:138 +0x87 fp=0x7ffffee76cd8 sp=0x7ffffee76cb8 pc=0x5630c94ef437\\\\\\\\nruntime.(*mcache).nextFree(0x7f7e1619e008, 0x5630cd2a722a, 0x7f7e1619e008, 0x8, 0xfffffffffffffff8)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/malloc.go:854 +0x89 fp=0x7ffffee76d10 sp=0x7ffffee76cd8 pc=0x5630c94e3c29\\\\\\\\nruntime.mallocgc(0x180, 0x5630cc009ea0, 0x1, 0x5630cd2a7260)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/malloc.go:1022 +0x7a5 fp=0x7ffffee76db0 sp=0x7ffffee76d10 pc=0x5630c94e4575\\\\\\\\nruntime.newobject(0x5630cc009ea0, 0x4000)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/malloc.go:1151 +0x3a fp=0x7ffffee76de0 sp=0x7ffffee76db0 pc=0x5630c94e497a\\\\\\\\nruntime.malg(0x1196e00008000, 0x5630cd28d0e8)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/proc.go:3232 +0x33 fp=0x7ffffee76e20 sp=0x7ffffee76de0 pc=0x5630c9510be3\\\\\\\\nruntime.mpreinit(...)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/os_linux.go:324\\\\\\\\nruntime.mcommoninit(0x5630cd285500)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/proc.go:626 +0xc6 fp=0x7ffffee76e58 sp=0x7ffffee76e20 pc=0x5630c950a516\\\\\\\\nruntime.schedinit()\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/proc.go:543 +0x76 fp=0x7ffffee76eb0 sp=0x7ffffee76e58 pc=0x5630c950a176\\\\\\\\nruntime.rt0_go(0x7ffffee76fb8, 0x4, 0x7ffffee76fb8, 0x0, 0x7f7e1515c02a, 0x4, 0x7ffffee76fb8, 0x4fee76fe0, 0x5630c9535da0, 0x0, ...)\\\\\\\\n\\\\\\\\t/usr/lib/golang/src/runtime/asm_amd64.s:214 +0x129 fp=0x7ffffee76eb8 sp=0x7ffffee76eb0 pc=0x5630c9535ed9\\\\\\\\n\\\\\\\"\\\"\": unknown",
"StartedAt": "2020-11-27T02:53:11.621911146Z",
"FinishedAt": "2020-11-28T02:53:12.35136947Z"
},
"Image": "...",
"ResolvConfPath": "/.../resolv.conf",
"HostnamePath": "/.../hostname",
"HostsPath": "/.../hosts",
"LogPath": "/...-json.log",
"Name": "/service",
"RestartCount": 2,
"Driver": "overlay2",
"Platform": "linux",
"MountLabel": "",
"ProcessLabel": "",
"AppArmorProfile": "",
"ExecIDs": null,
"HostConfig": {
"Binds": [
"/home/ec2-user/logs:/logs",
"/var/www:/www"
],
"ContainerIDFile": "",
"LogConfig": {
"Type": "json-file",
"Config": {}
},
"NetworkMode": "default",
"PortBindings": {
"8082/tcp": [
{
"HostIp": "",
"HostPort": "8082"
}
]
},
"RestartPolicy": {
"Name": "always",
"MaximumRetryCount": 0
},
"AutoRemove": false,
"VolumeDriver": "",
"VolumesFrom": null,
"CapAdd": null,
"CapDrop": null,
"Capabilities": null,
"Dns": [],
"DnsOptions": [],
"DnsSearch": [],
"ExtraHosts": null,
"GroupAdd": null,
"IpcMode": "private",
"Cgroup": "",
"Links": null,
"OomScoreAdj": 0,
"PidMode": "",
"Privileged": false,
"PublishAllPorts": false,
"ReadonlyRootfs": false,
"SecurityOpt": null,
"UTSMode": "",
"UsernsMode": "",
"ShmSize": 67108864,
"Runtime": "runc",
"ConsoleSize": [
0,
0
],
"Isolation": "",
"CpuShares": 0,
"Memory": 629145600,
"NanoCpus": 0,
"CgroupParent": "",
"BlkioWeight": 0,
"BlkioWeightDevice": [],
"BlkioDeviceReadBps": null,
"BlkioDeviceWriteBps": null,
"BlkioDeviceReadIOps": null,
"BlkioDeviceWriteIOps": null,
"CpuPeriod": 0,
"CpuQuota": 0,
"CpuRealtimePeriod": 0,
"CpuRealtimeRuntime": 0,
"CpusetCpus": "",
"CpusetMems": "",
"Devices": [],
"DeviceCgroupRules": null,
"DeviceRequests": null,
"KernelMemory": 0,
"KernelMemoryTCP": 0,
"MemoryReservation": 0,
"MemorySwap": 1258291200,
"MemorySwappiness": null,
"OomKillDisable": false,
"PidsLimit": null,
"Ulimits": [
{
"Name": "nofile",
"Hard": 4096,
"Soft": 1024
}
],
"CpuCount": 0,
"CpuPercent": 0,
"IOMaximumIOps": 0,
"IOMaximumBandwidth": 0,
"MaskedPaths": [
"/proc/asound",
"/proc/acpi",
"/proc/kcore",
"/proc/keys",
"/proc/latency_stats",
"/proc/timer_list",
"/proc/timer_stats",
"/proc/sched_debug",
"/proc/scsi",
"/sys/firmware"
],
"ReadonlyPaths": [
"/proc/bus",
"/proc/fs",
"/proc/irq",
"/proc/sys",
"/proc/sysrq-trigger"
]
},
"GraphDriver": {
"Data": {
"LowerDir": "/.../diff",
"MergedDir": "/.../merged",
"UpperDir": "/.../diff",
"WorkDir": "/.../work"
},
"Name": "overlay2"
},
"Mounts": [
{
"Type": "bind",
"Source": "/home/ec2-user/logs/service",
"Destination": "/logs",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
},
{
"Type": "bind",
"Source": "/var/www/service",
"Destination": "/www",
"Mode": "",
"RW": true,
"Propagation": "rprivate"
}
],
"Config": {
"Hostname": "b20730462c1d",
"Domainname": "",
"User": "",
"AttachStdin": false,
"AttachStdout": false,
"AttachStderr": false,
"ExposedPorts": {
"8082/tcp": {}
},
"Tty": true,
"OpenStdin": false,
"StdinOnce": false,
"Env": [
"TZ=Europe/Lisbon",
"JAVA_OPTS=-XX:MinRAMPercentage=60 -XX:MaxRAMPercentage=95 -XshowSettings:vm",
"PATH=/opt/java/openjdk/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin",
"LANG=en_US.UTF-8",
"LANGUAGE=en_US:en",
"LC_ALL=en_US.UTF-8",
"JAVA_VERSION=jdk-11.0.7+10",
"JAVA_HOME=/opt/java/openjdk",
"profile=prod",
"service_name=service"
],
"Cmd": null,
"Image": "...:latest",
"Volumes": null,
"WorkingDir": "",
"Entrypoint": [
"/bin/sh",
"-c",
"/entrypoint.sh $profile $service_name"
],
"OnBuild": null,
"Labels": {
"name": "...",
"version": "\"0.0.1\""
}
},
"NetworkSettings": {
"Bridge": "",
"SandboxID": "...",
"HairpinMode": false,
"LinkLocalIPv6Address": "",
"LinkLocalIPv6PrefixLen": 0,
"Ports": {},
"SandboxKey": "/var/run/docker/netns/3873dd087817",
"SecondaryIPAddresses": null,
"SecondaryIPv6Addresses": null,
"EndpointID": "",
"Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"MacAddress": "",
"Networks": {
"bridge": {
"IPAMConfig": null,
"Links": null,
"Aliases": null,
"NetworkID": "...",
"EndpointID": "",
"Gateway": "",
"IPAddress": "",
"IPPrefixLen": 0,
"IPv6Gateway": "",
"GlobalIPv6Address": "",
"GlobalIPv6PrefixLen": 0,
"MacAddress": "",
"DriverOpts": null
}
}
}
}