armeria | microservice framework for any situation , from the creator
kandi X-RAY | armeria Summary
Support
Quality
Security
License
Reuse
- Handle a request .
- Handles a request .
- Build the complete URI .
- Transform a glob pattern into a regex pattern .
- Get validated assertion .
- Get the web server .
- Decodes unicode characters and encode them to bytes .
- Aggregates the response .
- Decode a UTF - 8 component .
- Configures the given server with Armeria settings .
armeria Key Features
armeria Examples and Code Snippets
Trending Discussions on armeria
Trending Discussions on armeria
QUESTION
I want to insert vacation and holiday dates to my pandas dataframe but can't figure out how... Something doesn't work out with the dates of my dataframe and the dates from the ferien-api and the holidays library. Here is my code:
import pandas as pd
from geopy.geocoders import Nominatim
def add_externals():
geolocator = Nominatim(user_agent="plantgrid", timeout=3)
location = geolocator.geocode("Schulweg 23, 26203 Wardenburg")
federal_state = "NI"
df = pd.DataFrame(pd.read_csv("Schachtschneider_further.csv", header=0))
print("----- Adding external data -----")
df["Auf. Datum"] = pd.to_datetime(df["Auf. Datum"])
df.index = df["Auf. Datum"].dt.date
df = WeatherIngest.add_daily_weather_data(df=df, location=location)
df = CalendarIngest.add_public_holidays(df=df, federal_state=federal_state)
df = CalendarIngest.add_school_holidays(df=df, federal_state=federal_state)
df.to_csv("Schachtschneider_externals.csv")
The add_public_holidays
function:
import pandas as pd
import holidays
def add_public_holidays(df: pd.DataFrame, federal_state: str):
federal_state_holidays = holidays.CountryHoliday(country='Germany', prov=federal_state, years=[2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020])
if 'public_holiday' not in df.columns:
df['public_holiday'] = 'no'
for date in df.index:
if date in federal_state_holidays:
df.loc[date, 'public_holiday'] = federal_state_holidays[date]
return df
And the add_school_holidays
:
import pandas as pd
import ferien
def add_school_holidays(df: pd.DataFrame, federal_state: str):
for year in range(2001, 2021):
federal_state_school_holidays = ferien.state_vacations(state_code=federal_state, year=year)
if 'school_holiday' not in df.columns:
df['school_holiday'] = 'no'
for date in df.index:
print(date)
for vac in federal_state_school_holidays:
if vac.start.date() <= date <= vac.end.date():
df.at[date, 'school_holiday'] = vac.name
return df
The add_daily_weather_data
function with the calc_daily_mean_weather_values
function:
import pandas as pd
from datetime import datetime
from geopy.location import Location
from wetterdienst.provider.dwd.observation import DwdObservationRequest, DwdObservationPeriod, DwdObservationResolution, DwdObservationParameter, DwdObservationDataset
from dwdweather import DwdWeather
def calc_daily_mean_weather_values(location: Location) -> pd.Series:
request = DwdObservationRequest(parameter = DwdObservationDataset.CLIMATE_SUMMARY,
resolution=DwdObservationResolution.DAILY,
period=DwdObservationPeriod.HISTORICAL, start_date=datetime(2001, 1, 11),
end_date=datetime(2020, 10, 28), tidy=True, humanize=True,
si_units=True).filter_by_station_id(station_id=[963])
df = request.values.all().df
return df
def add_daily_weather_data(df: pd.DataFrame, location: Location):
daily_mean_weather_values = calc_daily_mean_weather_values(location=location)
temperature = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'temperature_air_200']
temperature_values = temperature['value'].to_list()
temperature_values = [x - 273.15 for x in temperature_values]
df['mean_temp'] = temperature_values
humidity = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'humidity']
humidity_values = humidity['value'].to_list()
df['mean_humid'] = humidity_values
precipitation_height = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'precipitation_height']
precipitation_height_values = precipitation_height['value'].to_list()
df['mean_prec_height_mm'] = precipitation_height_values
df['total_prec_height_mm'] = [x * 24 for x in precipitation_height_values]
sunshine_duration = daily_mean_weather_values.loc[daily_mean_weather_values['parameter'] == 'sunshine_duration']
sunshine_duration_values = sunshine_duration['value'].to_list()
df['mean_sun_dur_min'] = sunshine_duration_values
df['total_sun_dur_h'] = [x * 24 / 60 for x in sunshine_duration_values]
return df
I'm trying around for really long now but do not come to a conclusion. Maybe someone already had a similar project and knows how to help me.
The problem is that the dates from the pandas dataframe and the dates from the ferien-api
or holidays library
, respectively, aren't from the same datatype and don't recognize each other, that's why I receive a data frame with two dates/ two index ('Auf. Datum'):
Auf. Datum,Auf. Datum,Acaena,Acantholimon,Acanthus,Acer palmatum,Aceriphyllum,Achillea,Achnatherum,Acinos,Aconitum,Aconogonon,Acorus,Actaea,Adenophora,Adiantum,Adonis,Aegopodium,Aethionema,Agapanthus,Agastache,Agrimonia,Ajania,Ajuga,Akebia,Alcalthaea,Alcea,Alchemilla,Alisma,Alliaria,Allium,Alopecurus,Aloysia,Alstroemeria,Althaea,Alyssum,Amelanchier,Ammophila,Amorpha,Amsonia,Anacyclus,Ananassalbei,Anaphalis,Anchusa,Andropogon,Androsace,Anemone,Anemonopsis,Anethum,Angelica,Anisodontea,Annemona,Antennaria,Anthemis,Anthericum,Anthoxanthum,Anthriscus,Anthyllis,Apfel,Apfelquitte,Aponogeton,Aquilegia,Arabis,Aralia,Arctanthemum,Arctostaphylos,Arenaria,Arisaema,Aristolochia,Armeria,Armoracia,Arnica,Aronia,Arrhenatherum,Artemisia,Arum,Aruncus,Arundo,Asarum,Asclepia,Asparagus,Asperula,Asphodeline,Asphodelus,Asplenium,Aster,Astilbe,Astilboides,Astrantia,Athyrium,Atropa,Aubrieta,Avena,Azolla,Azorella,BLumenzwiebeln,Bacopa,Baerenklau 'White Lips',Baldellia ranunculoides,Ballota,Baptisia,Barbarea,Basilikum,Begonia,Belamcanda chinensis,Berberis,Bergenia,Bergprimel,Berkleya purpurea,Beta,Bigelowia nutallii,Birne,Birnenquitte h,Bistorta,Blechnum,Bletilla,Bluetenschleier,Bluetenwoge,Blumenzwiebel,Blutwurz 'Plenum',Boehmeria sieboldiana,Boltonia,Borago,Bouteloua,Brassica,Briza,Brombeere,Brunnera,Bryonia,Buddleja,Buglossoides,Buphthalmum,Butomus,Buxus,Calamagrostis,Calamintha,Calceolaria,Calendula,Calla,Callitriche,Caltha,Camassia,Campanula,Canna,Capsicum frutescens,Cardamine,Cardiocrinum,Carduncellus,Carex,Carlina,Carpinus,Carum,Caryopteris,Catananche,Centaurea,Centaurium,Centranthus,Cephalaria,Cerastium,Ceratophyllum,Ceratostigma,Ceterach officinarum,Chaenarrhinum,Chamaemelum,Chamomilla recutita,Chasmanthium,Cheilanthes lanosa,Cheiranthus cheiri,Chelidonium,Chelone,Chenopodium,Chiastophyllum,Chionodoxa,Chrypogon gryllos,Chrysanthemum,Cichorium,Cimicifuga,Cirsium,Cistus,Claytonia sibirica,Clematis,Cochlearia officinalis,Codonopsis,Colchicum,Colocasia,Convallaria,Convolvulus,Cordyline,Coreopsis,Coriandrum,Cornus,Coronilla varia,Cortaderia,Cortusa matthioli,Corydalis,Coryllus,Cosmos,Cotoneatser,Cotula,Crambe,Crassula,Crataegus,Crepis biennis,Crinum,Crocosmia,Crocus,Cryptotaenia japonica 'Atropurpurea',Cychorium instibus 'Wegwarte',Cyclamen,Cymbalaria,Cymbopogon,Cynara,Cynoglossum,Cyperus,Cypripedium,Cyrtomium,Cystopteris,Cytisus,Dachgartenstauden,Dactylorhiza,Dahlia,Dalina,Darmera,Datisca cannabina,Daucus,Delosperma,Delphinium,Dendranthema,Deschampsia,Dianthus,Diascia,Dicentra,Dicksonia,Dictamnus,Dierama pulcherimum,Diervilla,Digiplexis,Digitalis,Dionaea,Diplotaxis tenuifolia her,Dipsacus,Disporum flavens,Dodecatheon,Doronicum,Draba,Dracocephalum,Drosera,Dryas,Dryopteris,Duchesnea indica,Echinacea,Echinops,Echium,Edelweiss,Edraianthus graminifolius,Eichhornia,Eleocharis,Elodea,Epilobium,Epimedium,Epipactis,Equisetum,Eragrostis,Eranthis hyemalis,Eremurus,Erigeron,Erinus,Eriocephalus africanus,Eriophorum,Eriophyllum,Erodium,Eryngium,Erysimum,Erythronium,Eucalyptus,Eucomis,Euonymus,Eupatorium,Euphorbia,Exotischer Bluetensaum,Fallopia,Farn,Festuca,Filipendula,Foeniculum,Fontinalis,Forsythia,Fragaria,Francoa sonchifolia varsonchifoliahne Bil,Freiland-Orchidee 'Formosana',Fritillaria,Fruehlingsstauden,Fuchsia,Funkie,Gaillardia,Galanthus nivalis ssp nivaliswiebel,Galega,Galium,Galtonia,Gartenaurikel rot,Gaura,Genista sagittalis,Gentiana,Geranium,Geum,Gillenia,Gladiolus,Glechoma,Globularia,Glyceria,Glycyrrhiza,Goniolimon,Graeser in Sorten,Gratiola officinalis,Gunnera,Gymnocarpium dryopteris,Gynostemma,Gypsophila,Hakonechloa,Halimiocistus,Hamamelis,Haplopappus lyalii,Hauswurz,Havelschwan 'Yellow Satellit',Hedera,Heimischer Bluetensaum,Helenium,Helianthemum,Helianthus,Helichrysum,Helictotrichon,Heliopsis,Helleborus,Helonias bullata,Hemerocallis,Hepatica,Heracium aurantiacum,Herbstanemonen rot,Herbstenzian,Herniaria,Hesperis,Heuchea,Heuchera,Heucherella,Hibiscus,Hieracium,Himbeeren,Hippuris,Hohe,Holcus,Honigsalbei,Horminum,Hosta,Hottonia,Houttuynia,Humulus,Hutchinsia,Hyacinthoides,Hyacinthus multiflorawiebel,Hydrangea,Hydrocharis,Hylomecon,Hypericum,Hyssopus,Hystripatula,Iberis,Ilex,Imperata,Incarvillea,Indigofera,Indocalamus tesselatus,Inula,Ipheion uniflorum,Ipomoea,Iris,Isatis tinctoria,Isolepis cernua,Isotoma,Jasione,Jeffersonia,Johannisbeere,Josta B,Jovibarba,Juglans,Juncus,Kakteen winterhart,Kalimeris,Kamille,Kirengeshoma,Kissenprimel,Kletter-Erdbeere,Knautia,Kniphofia,Knoblaurauke,Koeleria,Kraeuter,Kreuzknabenkraut,Kuklturheidelbeeren i S /,Lageubrieta cultorum blau,Lamium,Lathyrus,Laurus,Lavandula,Lavatera,Ledum,Lemna,Leontopodium,Leonurus,Leptodermis,Leucanth,Leucojum,Leucosceptrum japonicum 'Goldenngel',Levisticum,Lewisia,Leycesteria formosa,Leymus,Liatris,Libertia ixioides 'Goldfinger',Lichtspieler,Ligularia,Ligusticum,Ligustrum,Lilium,Limonium,Linaria,Linum,Lionorus cardiaca,Lippia,Liriope,Lithodora,Lithospermum purpur,Lobelia,Lonicera,Lotos,Lunaria,Lupinen in Sorten Jgw,Lupinen versch Sorten bluehend,Lupinus,Luronium natans,Luzula,Lychnis,Lycium,Lycopus europaeus,Lysichiton,Lysimachia,Lythrum,Macleaya,Maianthemum,Majoran,Malva,Mandragora (Alraune),Margeriten Ester Red,Mariendistel,Mariubium vulgare,Marrubium,Marsilea quadrifolia,Matricaria,Matteuccia,Mazus,Meconopsis,Melica,Melissa,Melittis,Mentha,Menyanthes,Mertensia,Meum,Micromeria,Milium,Millium,Mimulus,Misc Littleebra JGW,Miscanthus,Mitchella repens,Mix-CC mit Solis im,Molinia,Monarda,Montia,Moorsegge,Morina longifolia,Muehlenbeckia,Muhlenbergia capillaris,Mukdenia,Mukgenia,Musa,Muscari,Myosotis,Myriophyllum,Myrrhis,Myrthis odorata,Narcissus,Narthecium ossifragum,Nasturtium,Nelkenwurz,Nelumbo,Neopaxia,Nepeta,Neuseelaenderflachs,Nierembergia repens,Nitella flexibilis,Nuphar,Nymphaea,Nymphoides,Ocimum,Oenanthe,Oenothera,Omphalodes,Onoclea,Ononis spinosa,Onopordum,Ophiopogon,Ophrys sphegodes incubacea,Opuntia,Orchidee,Orchis,Origano,Ornithogalum umbellatum,Orontium aquaticum,Osmunda,Oxalis,Pachyphragma macrophylla,Pachysandra,Paeonia,Paeonie,Paniculata,Panicum,Papaver,Paradisea liliastrum,Paris quadrifolia,Parnassia palustris,Paronychia kapela ssp serpyllifolia,Parthenium integrifolium,Parthenocissus var engelmannii,Patrinia scabiosifolia,Paulowuia tomentosa,Pelargonium endlicherianum,Peltiphyllum peltatum,Pennisetum,Penstemon,Perovskia,Persicaria,Petasites,Petrorhagia,Petroselinum,Peucedanum,Phalaris,Philadelphus,Phlox,Pholipullus Maiapfel,Phormium,Phragmites,Phuopsis,Phygelius,Phyla,Phyllitis,Physalis,Physocarpus,Physostegia,Phyteuma,Phytolacca,Pilularia globulifera,Pimpinella,Pinellia ternata,Pistia,Plantago lanceolata,Platycodon,Pleioblastus,Pleione,Poa,Podophyllum,Polemonium,Polygala,Polygonatum,Polygonum,Polypodium,Polystichum,Pontederia,Potamogeton,Potentilla,Pratia,Preslia,Primula,Prizelago,Prizelago alpina 'Icecube',Prizelago alpina sspalpina,Prunella,Prunus l Herbergii,Pseudofumaria alba,Pseudolysimachion,Pseudosasa,Pteridium,Pulmonaria,Pulsatilla,Puschkinia scilloideswiebel,Pycanthemum,Pycnanthemum,Quellmoos lose,Rabdosia longituba,Ramonda,Ranunculus,Raoulia australis,Ratibida,Reseda lutea,Reynoutria,Rhababer The Sutton,Rhabarber,Rhadiola rosea,Rheum,Rhodiola rosea,Rhodohypoxis,Rhodoxis,Rispengras,Robinia,Rodgersia,Romneya,Rosa,Roscoea,Rose,Rosmarin,Rosularia aizoon,Rudbeckia,Rumeabtusofilius,Rumeacetosa,Rumeofficinalis,Rumerugosus,Rumesanguineus,Rumescutataus,Rumescutatus,Rungia,Ruta,Saccharum (Erianthus) ravennae,Sagina,Sagittaria,Salbei,Salicaprea,Salielegantissima /,Salvia,Salvinia,Sambucus,Sanguinaria,Sanguisorba,Santolina,Saponaria,Sarracenia,Saruma henryi,Sasa,Satureja,Saururus,Saxifraga,Scabiosa,Schattentraeumer,Schizachyrium,Schizostylis coccinea,Schleierkraut kriechend,Schoenoplectus,Scilla,Scirpus,Scleranthus uniflorus,Scrophularia macrantha 'Cardinal Red',Scutellaria,Sedoro,Sedum,Seerose rosa groesseres Exemplar,Seidenmohn aubergine-farbig,Selaginella helvetica,Selinum,Semiaquilegia ecalcarata,Sempervivella,Sempervivium,Sempervivum,Senecio,Serratula tinctoria,Seseli,Sesleria,Setcracea hirsuta 'Swifttale',Sidalcea,Sideritis,Silbersommer,Silberwurz,Silene,Silinum walichianum,Silphium,Silybum,Sinarundinaria Jumbo (U),Sisyrinchium,Smilacina,Solanum,Soldanella,Solidago,Solidora,Solitaer,Sommerenzian,Sommernachtstraum,Sonnenhut schwarz/dunkel,Sorghastrum,SparMixCC,Sparganium,Spartina,Sphaeralcea ambigua 'Childerley',Sphagnum,Spilanthes 'Peek-A-Boo',Spiraea,Spodiopogon,Sporobolus,Stachelbeere,Stachys,Stauden,Steingartenstauden,Stellaria,Stengelloser Enzian,Stephanandra,Stevia,Stipa,Stokesia,Stratiotes,Stratoides,Strobelianthes,Strobilanthes atropurpureus,Succisa pratensis,Suesskirsche,Suessklee,Symphyandra pendula,Symphytum,Syringa,Tagetes,Tanacetum,Taraxacum pseudoroseum,Taxus,Telekia,Tellima,Telypteris palustris,Teppichsedum,Tetrapanapapyrifera 'Rex',Teucrium,Thalictrum,Thelypteris palustris,Thermopsis,Thymian,Thymus,Tiarella,Topinambour,Townsendia rothrockii,Trachystemon,Tradescantia,Traenendes Herz,Trapa,Tray,Trays,Tricyrtis,Trifolium,Trillium,Trollius,Tropaeolum,Tulipa,Tussilago farfara,Typha,Uncinia,Unicinia 'Rubra',Utricularia,Uvularia,Vaccinium myrtillus,Valeriana,Vancouveria hexandra,Veratrum,Verbascum,Verbena,Vernonia,Veronica,Viburnum,Vinca,Viola,Wahlenbergia albomarginata,Waldsteinia,Wasserhahnenfuss,Weigela,Weinrebe C /,Wisteria sinensis /,Woodsia,Wulfenia carinthiaca,Yucca,Zantedeschia,Zigadenus elegans,Zitronemelisse gelb/bunt,Zitronenverbene,Zizania,mean_temp,mean_humid,mean_prec_height_mm,total_prec_height_mm,mean_sun_dur_min,total_sun_dur_h,public_holiday,school_holiday
2001-01-12,2001-01-12,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0,-1.0,97.0,0.0,0.0,0.0,0.0,no,no
ANSWER
Answered 2021-Oct-27 at 14:40I solved my problem by changing every date object to datetime.date.
def add_externals():
geolocator = Nominatim(user_agent='plantgrid', timeout=3)
location = geolocator.geocode('Schulweg 23, 26203 Wardenburg')
federal_state = 'NI'
df = pd.DataFrame(pd.read_csv('Schachtschneider_further.csv', header=0)) # , index_col=0
print("----- Adding external data -----")
df['Auf. Datum'] = pd.to_datetime(df['Auf. Datum'])
df['Auf. Datum'] = df['Auf. Datum'].dt.date
df.index = df['Auf. Datum']
df = WeatherIngest.add_daily_weather_data(df=df, location=location)
df = CalendarIngest.add_public_holidays(df=df, federal_state=federal_state)
df = CalendarIngest.add_school_holidays(df=df, federal_state=federal_state)
def add_public_holidays(df: pd.DataFrame, federal_state: str):
federal_state_holidays = holidays.CountryHoliday(country='Germany', prov=federal_state, years=[2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020])
if 'public_holiday' not in df.columns:
df['public_holiday'] = 'no'
for date in df.index:
if date in federal_state_holidays:
df.at[date, 'public_holiday'] = federal_state_holidays[date]
return df
def add_school_holidays(df: pd.DataFrame, federal_state: str): # , date: datetime.date
for year in range(2001, 2021):
federal_state_school_holidays = ferien.state_vacations(state_code=federal_state, year=year)
if 'school_holiday' not in df.columns:
df['school_holiday'] = 'no'
index = df['Auf. Datum']
for date in index:
for vac in federal_state_school_holidays:
if vac.start.date() <= date <= vac.end.date():
df.at[date, 'school_holiday'] = vac.name
return df
QUESTION
Here's my current implementation of HttpService.serve()
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
return HttpResponse.from(req.aggregate().thenApply(ahr -> {
MyResponse myResponse = Utils.handle(ahr);
HttpResponse httpResponse Utils.toResponse(myResponse);
return httpResponse;
}));
}
I have a user-defined response delay which can vary per each individual request-response, and this is available in the myResponse
object.
What is the best way to apply this delay in a non-blocking way, I can see some delay
API-s but they are protected within HttpResponse
. Any extra tips or pointers to the streaming API design or decorators would be helpful. I'm really learning a lot from the Armeria code base :)
ANSWER
Answered 2020-Nov-10 at 11:58If you know the desired delay even before consuming the request body, you can simply use HttpResponse.delayed()
:
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
return HttpResponse.delayed(
HttpResponse.of(200),
Duration.ofSeconds(3),
ctx.eventLoop());
}
If you need to consume the content or perform some operation to calculate the desired delay, you can combine HttpResponse.delayed()
with HttpResponse.from()
:
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
return HttpResponse.from(req.aggregate().thenApply(ahr -> {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
MyResponse myResponse = Utils.handle(ahr);
HttpResponse httpResponse = Utils.toResponse(myResponse);
Duration myDelay = Utils.delayMillis(...);
return HttpResponse.delayed(httpResponse, myDelay, ctx.eventLoop());
// ^^^^^^^
});
}
If the delay is not actually delay but waiting for something to happen, you can use CompletableFuture.thenCompose()
which is more powerful:
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
return HttpResponse.from(req.aggregate().thenCompose(ahr -> {
// ^^^^^^^^^^^
My1stResponse my1stRes = Utils.handle(ahr);
// Schedule some asynchronous task that returns another future.
CompletableFuture myFuture = doSomething(my1stRes);
// Map the future into an HttpResponse.
return myFuture.thenApply(my2ndRes -> {
HttpResponse httpRes = Utils.toResponse(my1stRes, my2ndRes);
return httpRes;
});
});
}
For even more complicated workflow, I'd recommend you to look into Reactive Streams implementations such as Project Reactor and RxJava, which provides the tools for avoiding the callback hell. 😄
QUESTION
I have some code that currently works in Netty, which acts as an HTTPS proxy server, so we handle a CONNECT
method and add an SSL handler to the pipeline on the fly:
// SimpleChannelInboundHandler
@Override
protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest msg) {
if (HttpMethod.CONNECT.equals(msg.method())) { // HTTPS proxy
SslContext sslContext = Utils.getSslContext();
SslHandler sslHandler = sslContext.newHandler(ctx.alloc());
FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, CONNECTION_ESTABLISHED);
response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE);
ctx.writeAndFlush(response).addListener(l -> ctx.channel().pipeline().addFirst(sslHandler));
// do NOT close channel
return;
} else {
// other stuff
}
}
I am porting this whole thing to Armeria and would like some hints on how to approach this. I have the non-SSL flows working fine using something like this:
// HttpService
@Override
public HttpResponse serve(ServiceRequestContext ctx, HttpRequest req) throws Exception {
return HttpResponse.from(req.aggregate().thenApply(ahr -> MyServer.handle(ahr)));
}
Any tips would be appreciated !
ANSWER
Answered 2020-Nov-10 at 11:35Armeria unfortunately doesn't allow a user HttpService
to handle CONNECT
method. Please watch this issue to get notified when the feature is available.
QUESTION
Related to https://github.com/openzipkin/zipkin/pull/3239 , we came across some (maybe) odd behaviour and i wanted to know if below test works as expected or not:
import com.linecorp.armeria.client.WebClient;
import com.linecorp.armeria.common.HttpMethod;
import com.linecorp.armeria.common.HttpRequest;
import com.linecorp.armeria.common.HttpResponse;
import com.linecorp.armeria.common.HttpStatus;
import com.linecorp.armeria.server.Server;
import com.linecorp.armeria.server.ServerBuilder;
import java.util.concurrent.CompletableFuture;
import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class ArmeriaTraceBug {
@Test
public void test_trace_bug() throws Exception {
ServerBuilder sb = Server.builder();
sb.http(7003);
sb.service("/", (ctx, req) -> HttpResponse.of("Hello, world!"));
sb.routeDecorator()
.methods(HttpMethod.TRACE)
.pathPrefix("/")
.build((delegate, ctx, req) -> HttpResponse.of(HttpStatus.METHOD_NOT_ALLOWED));
Server server = sb.build();
CompletableFuture future = server.start();
future.join();
WebClient webClient = WebClient.of("http://localhost:7003/");
final HttpResponse response = webClient.execute(HttpRequest.of(HttpMethod.OPTIONS, "/something"));
assertThat(response.aggregate().get().status()).isEqualTo(HttpStatus.NOT_FOUND);
}
}
Basically we wanted to disable all TRACE
requests, and set pathPrefix("/")
to achieve this. But for some reason the OPTIONS
call to /something
gets trapped in the same path. If i remove the route decorator things work as expected.
ANSWER
Answered 2020-Oct-20 at 05:42Thanks Jorg Heymans for the question. Yeah, it's a bug and should be fixed by https://github.com/line/armeria/pull/3120 Thank you!
QUESTION
I would like to add a decorator to my armeria client that checks each http response if a certain http header was returned:
builder.decorator((delegate, ctx, req) -> {
final HttpResponse response = delegate.execute(ctx, req);
final AggregatedHttpResponse r = response.aggregate().join();
for (Map.Entry header : r.headers()) {
if ("warning".equalsIgnoreCase(header.getKey().toString())) {
throw new IllegalArgumentException("Detected usage of deprecated API for request "
+ req.toString() + ":\n" + header.getValue());
}
}
return response;
});
However, when starting my client it blocks on the join()
call and waits forever. Is there a standard pattern for this in Armeria ? Presumably i cannot just block on the response in an interceptor, but i could not find a way to access the response headers otherwise. Using subscribe
or toDuplicator
did not work any better though.
ANSWER
Answered 2020-Oct-04 at 07:35There are two ways to achieve the desired behavior.
The first option is to aggregate the response asynchronously and then convert it back to an HttpResponse
. The key APIs are AggregatedHttpResponse.toHttpResponse()
and HttpResponse.from(CompletionStage)
:
builder.decorator(delegate, ctx, req) -> {
final HttpResponse res = delegate.serve(ctx, req);
return HttpResponse.from(res.aggregate().thenApply(r -> {
final ResponseHeaders headers = r.headers();
if (headers...) {
throw new IllegalArgumentException();
}
// Convert AggregatedHttpResponse back to HttpResponse.
return r.toHttpResponse();
}));
});
This approach is fairly simple and straightforward, but it doesn't work for a streaming response, because it waits until the complete response body is ready.
If your service returns a potentially large streaming response, you can use a FilteredHttpResponse
to filter the response without aggregating anything:
builder.decorator(delegate, ctx, req) -> {
final HttpResponse res = delegate.serve(ctx, req);
return new FilteredHttpResponse(res) {
@Override
public HttpObject filter(HttpObject obj) {
// Ignore other objects like HttpData.
if (!(obj instanceof ResponseHeaders)) {
return obj;
}
final ResponseHeaders headers = (ResponseHeaders) obj;
if (headers...) {
throw new IllegalArgumentException();
}
return obj;
}
};
});
It's slightly more verbose than the first option, but it does not buffer the response in the memory, which is great for large streaming responses.
Ideally, in the future, we'd like to add more operators to HttpResponse
or StreamMessage
. Please stay tuned to this issue page and add any suggestions for better API: https://github.com/line/armeria/issues/3097
QUESTION
I searched for a bit but couldn't find an "Armeria API" to do this elegantly. I'm familiar with Netty so for the time being I'm using QueryStringEncoder
. Is there a better way to do this ? Here I have a dynamic Map
of params and I need to build the HTTP client programmatically. The Armeria WebClient
and RequestHeaders
builders provide ways to add headers and path, but not query string parameters.
HttpMethod httpMethod = HttpMethod.valueOf('GET');
String url = 'http://example.com'
String path = '/foo';
if (params != null) {
QueryStringEncoder qse = new QueryStringEncoder(url + path);
params.forEach((k, v) -> {
if (v != null) {
v.forEach(s -> qse.addParam(k, s));
}
});
try {
URI uri = qse.toUri();
path = path + "?" + uri.getRawQuery();
} catch (Exception e) {
throw new RuntimeException(e);
}
}
WebClient webClient = WebClient.builder(url).decorator(new HttpClientLogger()).build();
RequestHeadersBuilder rhb = RequestHeaders.builder(httpMethod, path);
ANSWER
Answered 2020-Aug-31 at 03:32Armeria has QueryParams
for building or parsing a query string:
// You don't really need a Map to build a QueryParams.
// See QueryParams.of() or QueryParamsBuilder.add() for more information.
Map paramMap = ...;
QueryParams params =
QueryParams.builder()
.add(paramMap)
.build();
WebClient client =
WebClient.builder("http://example.com")
.decorator(...)
.build();
AggregatedHttpResponse res =
client.get("/foo?" + params.toQueryString()).aggregate().join()
You might also find Cookie
useful.
QUESTION
When I use Armeria, I have 3 services:
Service A calls Service B and Service C.
Should I call B and C's blocking stub in A's blockingTaskExecutor or some other better way?
ANSWER
Answered 2020-Aug-25 at 22:35Let me assume that you're asking about gRPC. In asynchronous frameworks like Armeria, it is recommended to use a non-blocking stub to make a call, so that there are no blocking calls and thus the calls to other services (Service B and C in your case) are all done in an event loop thread. This yields potentially higher performance thanks to less amount of context switching and more robustness when the other services are not responsive enough.
You can use the default stub generated by gRPC-Java to do that, but the end result may be more complex than necessary, so I'd recommend using a third party stub generators such as reactive-grpc, which provides the integration with RxJava and Project Reactor.
If you are using Kotlin, you might want to give grpc-kotlin a try, but please keep in mind that it's at the early stage.
QUESTION
I'm discovering Armeria framework and I want to consume a REST service. Using the Armeria WebClient:
WebClient webClient = WebClient.of("http://localhost:9090");
RequestHeaders getJson = RequestHeaders.of(HttpMethod.GET, "/some-service",
HttpHeaderNames.CONTENT_TYPE, "application/json", "SomeHeader", "armeriaTest");
return webClient.execute(getJson).aggregate().thenApply(resp->{
if(HttpStatus.OK.equals(resp.status())) {
return parseBody(resp.contentUtf8());
}else if(HttpStatus.BAD_REQUEST.equals(resp.status())){
throw new IllegalStateException("not exists");
}
throw new RuntimeException("Error");
});
This code returns a CompletionStage that will be resolved asynchronously, because if I do a join() or get() right here causes an "java.lang.IllegalStateException: Blocking event loop, don't do this."
My question is: What if I want to use a third party httpclient library (like Apache HttpClient) instead the Web? The client call should be wrapped in a Future too? How should I manage the client requests to fit in the framework approach and avoid the "Blocking event loop" issue?
Thanks to all!
ANSWER
Answered 2020-Jul-04 at 17:06Yes. You should never perform any blocking operations when your code is running in an event loop thread. You can perform a blocking operation by submitting it to other thread pool dedicated to handling blocking operations.
If you are using Armeria on the server side, you can get one via ServiceRequestContext.blockingTaskExecutor()
:
Server server = Server
.builder()
.service("/", (ctx, req) -> {
CompletableFuture f1 = CompletableFuture.supplyAsync(() -> {
// Perform some blocking operations that return a string.
}, ctx.blockingTaskExecutor());
CompletableFuture f2 = f1.thenApply(result -> {
// Transform the result into an HttpResponse.
return HttpResponse.of("Result: %s", result);
});
return HttpResponse.from(f2);
})
.build();
If you are not using Armeria on the server side, you can use other Executor
provided by your platform, or you can even create a new ThreadPoolExecutor
dedicated to handling blocking operations.
QUESTION
I have been trying to make an https connection using armeria WebClient
Since the connection factory is not specified I am getting javax.net.ssl.SSLHandshakeException
could anyone help with a relevant example.? Thanks
ANSWER
Answered 2020-Apr-06 at 07:08 RequestHeaders header = RequestHeaders.of(HttpMethod.GET, endpoint, HttpHeaderNames.COOKIE,
cookieHeader);
WebClient.of(clientFactory(), hosturl)
.execute(header)
.aggregate()
.whenCompleteAsync((resp,cause)->{
if(cause != null) {
//TODO
}
else if(resp.status()==HttpStatus.OK) {
//TODO
}
else
{
//TODO
}
});
public static ClientFactory clientFactory() {
return ClientFactory.builder().sslContextCustomizer(b -> b.trustManager(InsecureTrustManagerFactory.INSTANCE))
.idleTimeout(Duration.ZERO).build();
}
QUESTION
I'm trying to run Zipkin on Kubernetes cluster. This is my Deployment file:
apiVersion: v1
kind: Service
metadata:
name: zipkin
namespace: default
labels:
app: zipkin
spec:
type: NodePort
selector:
app: zipkin
ports:
- name: http
port: 9411
protocol: "TCP"
---
apiVersion: apps/v1
kind: Deployment
metadata:
annotations:
fabric8.io/git-commit: "78bd65851c7d9e22652957107fc339a55f80b606"
fabric8.io/git-branch: "release-v0.1.5"
fabric8.io/metrics-path: "dashboard/file/kubernetes-pods.json/?var-project=zipkin&var-version=0.1.5"
fabric8.io/build-id: "3"
fabric8.io/git-url: "http://gogs.ux.fabric8.io/gogsadmin/oss-parent/commit/78bd65851c7d9e22652957107fc339a55f80b606"
fabric8.io/build-url: "http://jenkins.ux.fabric8.io/job/oss-parent/3"
labels:
app: zipkin
name: zipkin
spec:
replicas: 1
selector:
matchLabels:
app: zipkin
template:
metadata:
annotations:
fabric8.io/git-commit: "78bd65851c7d9e22652957107fc339a55f80b606"
fabric8.io/metrics-path: "dashboard/file/kubernetes-pods.json/?var-project=zipkin&var-version=0.1.5"
fabric8.io/build-id: "3"
fabric8.io/build-url: "http://jenkins.ux.fabric8.io/job/oss-parent/3"
fabric8.io/git-branch: "release-v0.1.5"
fabric8.io/git-url: "http://gogs.ux.fabric8.io/gogsadmin/oss-parent/commit/78bd65851c7d9e22652957107fc339a55f80b606"
labels:
app: zipkin
spec:
containers:
- env:
- name: COLLECTOR_KAFKA_ENABLED
value: "true"
- name: TRANSPORT_TYPE
value: http
- name: KAFKA_BOOTSTRAP_SERVERS
value: http://kafka-headless:9092
- name: HTTP_COLLECTOR_ENABLED
value: "true"
- name: COLLECTOR_ACTIVEMQ_ENABLED
value: "false"
- name: COLLECTOR_RABBITMQ_ENABLED
value: "false"
- name: QUERY_LOG_LEVEL
value: DEBUG
- name: logging.level.zipkin2
value: DEBUG
- name: "KUBERNETES_NAMESPACE"
value: default
image: "openzipkin/zipkin:latest"
name: zipkin
ports:
- name: http
containerPort: 9411
readinessProbe:
httpGet:
path: /api/v1/services
port: 9411
initialDelaySeconds: 20
periodSeconds: 15
failureThreshold: 6
livenessProbe:
httpGet:
path: /health
port: 9411
initialDelaySeconds: 20
resources:
limits:
cpu: "0"
memory: "0"
requests:
cpu: "0"
memory: "0"
when I call /health
endpoint from other deployment inside of my cluster with pod's ip, I can access to it and this is my output:
curl 10.42.4.17:9411/health
{
"status" : "UP",
"zipkin" : {
"status" : "UP",
"details" : {
"InMemoryStorage{}" : {
"status" : "UP"
},
"KafkaCollector{bootstrapServers=http://kafka-headless:9092, topic=zipkin}" : {
"status" : "UP"
}
}
}
but when I try to access with service name, I can't.
curl http://zipkin:9411/health
curl: (7) Failed to connect to zipkin port 9411: Connection refused
this is the output of kubectl describe svc zipkin
kubectl describe svc zipkin
Name: zipkin
Namespace: default
Labels: app=zipkin
Annotations: field.cattle.io/publicEndpoints:
[{"addresses":["192.168.164.42"],"port":30562,"protocol":"TCP","serviceName":"default:zipkin","allNodes":true}]
kubectl.kubernetes.io/last-applied-configuration:
{"apiVersion":"v1","kind":"Service","metadata":{"annotations":{},"labels":{"app":"zipkin"},"name":"zipkin","namespace":"default"},"spec":{...
Selector: app=zipkin
Type: NodePort
IP: 10.43.186.82
Port: http 9411/TCP
TargetPort: 9411/TCP
NodePort: http 30562/TCP
Endpoints:
Session Affinity: None
External Traffic Policy: Cluster
Events:
and: kubectl logs zipkin-9898fcf7f-2nmkx
oo
oooo
oooooo
oooooooo
oooooooooo
oooooooooooo
ooooooo ooooooo
oooooo ooooooo
oooooo ooooooo
oooooo o o oooooo
oooooo oo oo oooooo
ooooooo oooo oooo ooooooo
oooooo ooooo ooooo ooooooo
oooooo oooooo oooooo ooooooo
oooooooo oo oo oooooooo
ooooooooooooo oo oo ooooooooooooo
oooooooooooo oooooooooooo
oooooooo oooooooo
oooo oooo
________ ____ _ _____ _ _
|__ /_ _| _ \| |/ /_ _| \ | |
/ / | || |_) | ' / | || \| |
/ /_ | || __/| . \ | || |\ |
|____|___|_| |_|\_\___|_| \_|
:: version 2.21.0 :: commit 36b7d32 ::
2020-04-04 12:38:52.851 DEBUG 1 --- [ main] z.s.i.ZipkinModuleImporter : no modules found under path zipkin.internal.module
2020-04-04 12:38:52.862 DEBUG 1 --- [ main] z.s.i.ZipkinActuatorImporter : attempting to load actuator configuration: [org.springframework.boot.actuate.autoconfigure.beans.BeansEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.condition.ConditionsReportEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.context.properties.ConfigurationPropertiesReportEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.env.EnvironmentEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.management.HeapDumpWebEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.logging.LoggersEndpointAutoConfiguration, org.springframework.boot.actuate.autoconfigure.management.ThreadDumpEndpointAutoConfiguration]
2020-04-04 12:38:53.941 INFO 1 --- [ main] z.s.ZipkinServer : Starting ZipkinServer on zipkin-9898fcf7f-2nmkx with PID 1 (/zipkin/BOOT-INF/classes started by zipkin in /zipkin)
2020-04-04 12:38:53.942 INFO 1 --- [ main] z.s.ZipkinServer : The following profiles are active: shared
2020-04-04 12:38:56.034 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.verboseExceptions: rate-limit=10 (default)
2020-04-04 12:38:56.056 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.verboseSocketExceptions: false (default)
2020-04-04 12:38:56.056 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.verboseResponses: false (default)
2020-04-04 12:38:56.099 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.ConsumerConfig : ConsumerConfig values:
allow.auto.create.topics = true
auto.commit.interval.ms = 5000
auto.offset.reset = earliest
bootstrap.servers = [http://kafka-headless:9092]
check.crcs = true
client.dns.lookup = default
client.id =
client.rack =
connections.max.idle.ms = 540000
default.api.timeout.ms = 60000
enable.auto.commit = true
exclude.internal.topics = true
fetch.max.bytes = 52428800
fetch.max.wait.ms = 500
fetch.min.bytes = 1
group.id = zipkin
group.instance.id = null
heartbeat.interval.ms = 3000
interceptor.classes = []
internal.leave.group.on.close = true
isolation.level = read_uncommitted
key.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer
max.partition.fetch.bytes = 1048576
max.poll.interval.ms = 300000
max.poll.records = 500
metadata.max.age.ms = 300000
metric.reporters = []
metrics.num.samples = 2
metrics.recording.level = INFO
metrics.sample.window.ms = 30000
partition.assignment.strategy = [class org.apache.kafka.clients.consumer.RangeAssignor]
receive.buffer.bytes = 65536
reconnect.backoff.max.ms = 1000
reconnect.backoff.ms = 50
request.timeout.ms = 30000
retry.backoff.ms = 100
sasl.client.callback.handler.class = null
sasl.jaas.config = null
sasl.kerberos.kinit.cmd = /usr/bin/kinit
sasl.kerberos.min.time.before.relogin = 60000
sasl.kerberos.service.name = null
sasl.kerberos.ticket.renew.jitter = 0.05
sasl.kerberos.ticket.renew.window.factor = 0.8
sasl.login.callback.handler.class = null
sasl.login.class = null
sasl.login.refresh.buffer.seconds = 300
sasl.login.refresh.min.period.seconds = 60
sasl.login.refresh.window.factor = 0.8
sasl.login.refresh.window.jitter = 0.05
sasl.mechanism = GSSAPI
security.protocol = PLAINTEXT
security.providers = null
send.buffer.bytes = 131072
session.timeout.ms = 10000
ssl.cipher.suites = null
ssl.enabled.protocols = [TLSv1.2, TLSv1.1, TLSv1]
ssl.endpoint.identification.algorithm = https
ssl.key.password = null
ssl.keymanager.algorithm = SunX509
ssl.keystore.location = null
ssl.keystore.password = null
ssl.keystore.type = JKS
ssl.protocol = TLS
ssl.provider = null
ssl.secure.random.implementation = null
ssl.trustmanager.algorithm = PKIX
ssl.truststore.location = null
ssl.truststore.password = null
ssl.truststore.type = JKS
value.deserializer = class org.apache.kafka.common.serialization.ByteArrayDeserializer
2020-04-04 12:38:56.208 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.useEpoll: true (default)
2020-04-04 12:38:56.210 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.maxNumConnections: 2147483647 (default)
2020-04-04 12:38:56.211 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.numCommonWorkers: 2 (default)
2020-04-04 12:38:56.212 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.numCommonBlockingTaskThreads: 200 (default)
2020-04-04 12:38:56.215 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultMaxRequestLength: 10485760 (default)
2020-04-04 12:38:56.216 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultMaxResponseLength: 10485760 (default)
2020-04-04 12:38:56.217 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultRequestTimeoutMillis: 10000 (default)
2020-04-04 12:38:56.218 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultResponseTimeoutMillis: 15000 (default)
2020-04-04 12:38:56.218 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultConnectTimeoutMillis: 3200 (default)
2020-04-04 12:38:56.219 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultWriteTimeoutMillis: 1000 (default)
2020-04-04 12:38:56.220 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultServerIdleTimeoutMillis: 15000 (default)
2020-04-04 12:38:56.221 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultClientIdleTimeoutMillis: 10000 (default)
2020-04-04 12:38:56.222 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2PingTimeoutMillis: 0 (default)
2020-04-04 12:38:56.222 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2InitialConnectionWindowSize: 1048576 (default)
2020-04-04 12:38:56.223 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2InitialStreamWindowSize: 1048576 (default)
2020-04-04 12:38:56.224 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2MaxFrameSize: 16384 (default)
2020-04-04 12:38:56.225 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2MaxStreamsPerConnection: 2147483647 (default)
2020-04-04 12:38:56.226 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp2MaxHeaderListSize: 8192 (default)
2020-04-04 12:38:56.227 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp1MaxInitialLineLength: 4096 (default)
2020-04-04 12:38:56.228 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp1MaxHeaderSize: 8192 (default)
2020-04-04 12:38:56.229 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultHttp1MaxChunkSize: 8192 (default)
2020-04-04 12:38:56.230 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultUseHttp2Preface: true (default)
2020-04-04 12:38:56.230 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultUseHttp1Pipelining: false (default)
2020-04-04 12:38:56.230 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultUseHttp2PingWhenNoActiveStreams: false (default)
2020-04-04 12:38:56.231 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultBackoffSpec: exponential=200:10000,jitter=0.2 (default)
2020-04-04 12:38:56.232 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.defaultMaxTotalAttempts: 10 (default)
2020-04-04 12:38:56.233 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.routeCache: maximumSize=4096 (default)
2020-04-04 12:38:56.233 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.routeDecoratorCache: maximumSize=4096 (default)
2020-04-04 12:38:56.233 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.compositeServiceCache: maximumSize=256 (default)
2020-04-04 12:38:56.234 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.parsedPathCache: maximumSize=4096 (default)
2020-04-04 12:38:56.234 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.headerValueCache: maximumSize=4096 (default)
2020-04-04 12:38:56.234 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.fileServiceCache: maximumSize=1024 (default)
2020-04-04 12:38:56.240 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.cachedHeaders: :authority,:scheme,:method,accept-encoding,content-type (default)
2020-04-04 12:38:56.243 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.annotatedServiceExceptionVerbosity: unhandled (default)
2020-04-04 12:38:56.246 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.useJdkDnsResolver: false (default)
2020-04-04 12:38:56.246 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.reportBlockedEventLoop: true (default)
2020-04-04 12:38:56.247 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.validateHeaders: true (default)
2020-04-04 12:38:56.247 INFO 1 --- [ main] c.l.a.c.Flags : com.linecorp.armeria.useLegacyMeterNames: false (default)
2020-04-04 12:38:56.248 INFO 1 --- [ main] c.l.a.c.Flags : Using /dev/epoll
2020-04-04 12:38:56.547 INFO 1 --- [pool-2-thread-1] o.a.k.c.u.AppInfoParser : Kafka version: 2.4.1
2020-04-04 12:38:56.547 INFO 1 --- [pool-2-thread-1] o.a.k.c.u.AppInfoParser : Kafka commitId: c57222ae8cd7866b
2020-04-04 12:38:56.548 INFO 1 --- [pool-2-thread-1] o.a.k.c.u.AppInfoParser : Kafka startTimeMs: 1586003936543
2020-04-04 12:38:56.557 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.KafkaConsumer : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Subscribed to topic(s): zipkin
2020-04-04 12:38:56.558 INFO 1 --- [pool-2-thread-1] z.c.k.KafkaCollectorWorker : Kafka consumer starting polling loop.
2020-04-04 12:38:57.002 INFO 1 --- [ main] c.l.a.s.d.DocStringExtractor : Using com.linecorp.armeria.thrift.jsonDir: META-INF/armeria/thrift
2020-04-04 12:38:57.224 INFO 1 --- [pool-2-thread-1] o.a.k.c.Metadata : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Cluster ID: NxPNZeYPRLChEBVHfUiuAA
2020-04-04 12:38:57.227 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.AbstractCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Discovered group coordinator 10.42.6.12:9092 (id: 2147483647 rack: null)
2020-04-04 12:38:57.235 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.AbstractCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] (Re-)joining group
2020-04-04 12:38:57.255 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.AbstractCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] (Re-)joining group
2020-04-04 12:38:57.268 INFO 1 --- [ main] c.l.a.c.u.SystemInfo : Hostname: zipkin-9898fcf7f-2nmkx (from /proc/sys/kernel/hostname)
2020-04-04 12:38:57.560 DEBUG 1 --- [pool-2-thread-1] z.c.k.KafkaCollectorWorker : Kafka polling returned batch of 0 messages.
2020-04-04 12:38:58.200 INFO 1 --- [oss-http-*:9411] c.l.a.s.Server : Serving HTTP at /0.0.0.0:9411 - http://127.0.0.1:9411/
2020-04-04 12:38:58.207 INFO 1 --- [ main] c.l.a.s.ArmeriaAutoConfiguration : Armeria server started at ports: {/0.0.0.0:9411=ServerPort(/0.0.0.0:9411, [http])}
2020-04-04 12:38:58.268 INFO 1 --- [ main] z.s.ZipkinServer : Started ZipkinServer in 7.288 seconds (JVM running for 12.716)
2020-04-04 12:38:58.566 DEBUG 1 --- [pool-2-thread-1] z.c.k.KafkaCollectorWorker : Kafka polling returned batch of 0 messages.
2020-04-04 12:38:59.568 DEBUG 1 --- [pool-2-thread-1] z.c.k.KafkaCollectorWorker : Kafka polling returned batch of 0 messages.
2020-04-04 12:39:00.265 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.ConsumerCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Finished assignment for group at generation 117: {consumer-zipkin-1-fb98f8ee-4b85-4616-b60b-35ef4b41706d=Assignment(partitions=[zipkin-0])}
2020-04-04 12:39:00.282 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.AbstractCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Successfully joined group with generation 117
2020-04-04 12:39:00.294 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.ConsumerCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Adding newly assigned partitions: zipkin-0
2020-04-04 12:39:00.316 INFO 1 --- [pool-2-thread-1] o.a.k.c.c.i.ConsumerCoordinator : [Consumer clientId=consumer-zipkin-1, groupId=zipkin] Setting offset for partition zipkin-0 to the committed offset FetchPosition{offset=0, offsetEpoch=Optional.empty, currentLeader=LeaderAndEpoch{leader=10.42.4.102:9092 (id: 1 rack: null), epoch=-1}}
2020-04-04 12:39:00.570 DEBUG 1 --- [pool-2-thread-1] z.c.k.KafkaCollectorWorker : Kafka polling returned batch of 0 messages.
can anybody help me?
ANSWER
Answered 2020-Apr-04 at 12:50>> kubectl get deployment zipkin
NAME READY UP-TO-DATE AVAILABLE AGE
zipkin 0/1 1 0 14m
This indicates that the pod is not ready, hence the service will not add that pod's IP in the list of endpoints. Check the readiness probe of your pod by describing it and debug the issue that's making it non-ready. Once this if fixed, you'll start seeing some endpoints populated when you describe the service & that will enable you to access the service by DNS name.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install armeria
You can use armeria like any standard Java library. Please include the the jar files in your classpath. You can also use any IDE and you can run and debug the armeria component as you would do with any other Java program. Best practice is to use a build tool that supports dependency management such as Maven or Gradle. For Maven installation, please refer maven.apache.org. For Gradle installation, please refer gradle.org .
Support
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesExplore Kits - Develop, implement, customize Projects, Custom Functions and Applications with kandi kits
Save this library and start creating your kit
Share this Page